On Feb 19, 10:18 pm, MikeTek <[email protected]> wrote:
> That's exactly what i'm looking for thanks so much!
I hesitate to contradict Marcelo, but getBounds will produce a
rectangle. I doubt that the boundaries of boroughs are quite so
accommodating! Have a look at Mike's EPoly extension, which (when
loaded after the API script) will add a .contains() method to
polygons, rather than using their bounding boxes. That would allow
if (Manhattan.contains(latlng)) {
alert('Point is in Manhattan');
}
If you use encoded polygons, you can define more than one region to be
part of a single polygon; or define "doughnut" polygons with holes in
them; or even both. I don't know whether Mike's .contains() will cope
with that, although I confidently expect that it will.
http://econym.org.uk/gmap/epoly.htm
> I'm doing this in PHP script - do you recall offhand the best way to
> access the "getBounds().contains" segment of the above code? Is there
> a server-side call that can be made by requesting to google or should
> I use javascript mixed with the PHP?
Bear in mind that PHP is executed on the server before -- or as -- the
page gets transmitted to the client; and the API is Javascript
executed on the client. Don't get confused between what gets executed
where and when -- although you will be in good company! All PHP does
is produce the web page which is executed by the client browser.
If you Google for "point in polygon analysis" you will find examples
of methods which can be used server-side: I've used Solution 1 from
http://astronomy.swin.edu.au/~pbourke/geometry/insidepoly/
Andrew
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---