0

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

Community
  • 1
  • 1
Niklas Rosencrantz
  • 25,640
  • 75
  • 229
  • 424

1 Answers1

1

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.

Josnidhin
  • 12,469
  • 9
  • 42
  • 61
  • OK. Thanks! I also had some luck parsing this json serverside with python. I'll see which works best: javascript and python and will follow up. A link to my geospatial mapping effort is http://www.koolbusiness.com – Niklas Rosencrantz Dec 06 '11 at 04:56