You could also do rough checks to narrow down the possible polygons
the point could be in (and therefore what polygons need to be tested
with the full algorithm) by testing whether the point is within the
bounds of each polygon too (since google provides a function to easily
get the bounds).

Performance would either go up (if the bounds are all precomputed when
the polygons are loaded) or down (if it has to compute the bounds by
iterating the points) :).

On Sep 18, 11:08 pm, TinyGrasshopper <[EMAIL PROTECTED]> wrote:
> There are a bunch of algorithms for testing if a point lies within a
> polygon. You could test each polygon with one of those.
>
> Here are some with code examples (in c but the javascript would be
> virtually identical)http://local.wasp.uwa.edu.au/~pbourke/geometry/insidepoly/
>
> Cheers,
> Chris
>
> On Sep 18, 10:56 pm, "Josh Rosenthal" <[EMAIL PROTECTED]> wrote:
>
> > Hmm.  I like.  However, are we dependent on relying on user interaction in
> > the form of clicks?  Simulating this for say... a marker's dragend event,
> > doesn't provide the overlay parameter.  Even were we to trigger a click
> > programmatically, it seems that we'd need to know the overlay in advance.
> >  Can we get our "coordinate not in clickable polygon" info from other
> > coordinate based events?
>
> > On Thu, Sep 18, 2008 at 2:41 AM, Mike Williams <[EMAIL PROTECTED]>wrote:
>
> > > You can easily recognise clicks that occur on the base map rather than
> > > on a clickable polygon by noticing that the second parameter of the map
> > > "click" event is null.
>
> > > That won't help if the click finds a clickable marker or info window
> > > above the polygon layer.
>
> > > --
> > >http://econym.org.uk/gmap
> > > The Blackpool Community Church Javascript Team
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" 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-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to