Reputation: 26661
My problem is that eg results[0].address_components[2].short_name.toLowerCase();
in some cases returns the city and in some cases the region/state. How should I do to always get the locality (city) and which element is always the admin area (region/state)?
Thanks for any insight. The manual is here http://code.google.com/apis/maps/documentation/geocoding/#JSON and the two names, if they exist, I want to retrieve for a place is the admin area (state/region) and the locality (city) where one instance is as long as `India > Gujarat > Ahmedabad > Ahmedabad > Navrangpura > Shreyas Colony > Chimanlal Girdharlal Rd
I would like a solution in python or javascript preferably python and I see that there is a PHP question about this how to parse a Google Maps geocoding result
Upvotes: 0
Views: 617
Reputation: 12504
You will have to look at the types array and then extract the values accordingly. Further down the page they have an explanation of the different types
http://code.google.com/apis/maps/documentation/geocoding/#Types
Even then you might still have some problem. That is because of the address structure in different countries.
Upvotes: 1