On Feb 27, 12:40 am, PhilR8 <[email protected]> wrote:
> So, similarly, here's a test map:
>
> http://pages.towson.edu/preese/av/point_in_poly_test.html
>
> As you can probably deduce from the URL, I'm trying to do some point-
> in-polygon stuff.  Specifically, using the click listener to open a
> marker infowindow that is inside of the polygon.  I have two polygons
> in the demo above (Utah and Wyoming) and corresponding markers, but no
> matter where I click in either polygon, the Wyoming infowindow is
> opened.  

You're not obtaining function closure on the polygons.
Just like you create the markers in a separate function, you need to
do the same with the polygons.
http://econym.org.uk/gmap/closure.htm

--
Marcelo - http://maps.forum.nu
--




>I used to do this successfully in V2 using Mike Williams'
> point in polygon example, but I'm not having any luck figuring out how
> to do it in V3 from the examples that I've found.  Anyone have any
> thoughts?  Thanks in advance.
>
> On Feb 26, 3:07 pm, PhilR8 <[email protected]> wrote:
>
>
>
> > Just realized that I never properly thanked you, Michal.  Thanks!!!
>
> > On Jan 23, 3:30 am, Michał Biniek <[email protected]> wrote:
>
> > > Hi,
>
> > > you have set array of points as global - so you overwrite points last
> > > polygon's data.
> > > Try put var pts = []; to loop instead of making it global, like this:
>
> > >                 var pts = [];
> > >                 for (var i = 0; i < points.length; i++) {
> > >                         pts[i] = new 
> > > google.maps.LatLng(parseFloat(points[i].getAttribute
> > > ("lat")),
> > >                                                                 
> > > parseFloat(points[i].getAttribute("lng")));
> > >                 }
>
> > > Regards,
> > > Michal Biniek
>
> > > On 22 Sty, 23:56, PhilR8 <[email protected]> wrote:
>
> > > > I've been toying around with the XML tutorial written by Pamela
> > > > (http://gmaps-samples-v3.googlecode.com/svn/trunk/xmlparsing/
> > > > downloadurl_info.html) and am trying to do something similar with
> > > > polygons as well as markers.  Here's what I've been fooling around
> > > > with so far:
>
> > > >http://pages.towson.edu/preese/av/multiple_polys_from_xml.html
>
> > > > There are two polygons (Alabama, Arkansas) that I'd like to see on the
> > > > map, but instead I only see Arkansas.  I've been searching around the
> > > > group and figure that this is some sort of "last in a loop" JavaScript
> > > > bug (I think Ben Appleton posted this 
> > > > linkhttp://scriptnode.com/article/the-last-in-a-loop-bug/)
> > > > but I'm still wrestling with how to fix the problem.  Any thoughts?

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to