Is there a function in Google Maps API that will return an array of lat/lng values defining a polygon for a given location? For example:
- USA
- Nevada
- Las Vegas
If not available in Google Maps API, is there some online source I can get this info from?
Is there a function in Google Maps API that will return an array of lat/lng values defining a polygon for a given location? For example:
If not available in Google Maps API, is there some online source I can get this info from?
If you only want the bounding box then you can use the geocoding service, for example
and read results[0].geometry.bounds.northeast and results[0].geometry.bounds.southwest
On the other hand, if you want exact political borders you need to download and process shapefiles from somewhere, like Natural Earth Data or the US Census Bureau
I think it depends if you want the bounds of a pre-defined polygon or if you are making your own polygon for the state of Nevada for example. If you are doing you own then you can use build in functions to get the lat/longs. If you are looking for predefined ones then you will need to dig them up as they don't exist in v3 to my knowledge.
This nice guy has provided the states in XML format if that helps?
US States Graphical Boundaries
If you are looking to get the bounds of an existing polygon, then here is a method that works in V3: