Google-maps – Determining zoom level from single LatLong in Google Maps API

google-maps

I'm having some trouble with the Google Maps API; I want to determine a LatLong for a certain place (for example, from the name of a city), then focus my map on it. The LatLong part is working, and so is centering the map on that point. However, I cannot figure out how to determine what a good zoomlevel might be when I only have that single point. I cannot just go to some standard zoomlevel that might look good most of the time, 'cause what happens when the user enters "Russia" instead of "Amsterdam", for example? Some help would be appreciated 🙂

Best Solution

I just asked this question at Google IO. This feature exists, but is undocumented and doesn't have accessors for it yet. What you want to do is get the Structured Address. Inspect the json structure you get back and look for these new parameters. I'll post more information when I get a chance to try this out.