Google doesn't return anything that would be of any use for that 
purpose.

The only thing I can think of that might work would be to use a 
third-party reverse geocoder, and step outward from the geocoded point 
until the reverse geocoder says that you've left the region.

You could get the pixel position of the centre of your map with 
GProjection.fromLatLngToPixel(latlng,zoom) add half the width of your 
viewport to get an edge pixel, and step outward using 
GProjection.fromPixelToLatLng(pixel,zoom) to get a lat/lng for each 
zoom. When the reverse geocoder says that lat/lng is not in Paris any 
more, that gives you a ballpark figure for the zoom that fits Paris in 
that direction.

Since we're dealing with very wide error margins, you could just take 
that as your zoom level. Only a handful of regions (such as Chile and 
Argentina) are so long and thin that that would fail badly. To get them 
all right, repeat the process, once for North or South and once for East 
or West. There's no need to test all four directions because you can 
trust the geocoded point to be close to the midpoint.

It's still not going to be perfect for places with weird shapes like 
Vietnam and Somalia.

-- 
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