1

I want to parse the addresses from Google geocoding API and store it as: address city state zipcode country

Some places has full address from Google map and some just half, how can i know which part of the address is city, state or country? or just zipcode?

It would be helpful if some expert pointed out some help here.

Agostino
  • 2,723
  • 9
  • 48
  • 65
Basit
  • 16,316
  • 31
  • 93
  • 154
  • This could be of some help http://stackoverflow.com/questions/953150/general-address-parser-for-freeform-text – Shoban Feb 13 '10 at 04:37

1 Answers1

2

In the response the geocoding API breaks up the address into AdministrativeAreaName (usually State) and SubAdministrativeArea. The SubAdministrativeArea area includes LocalityName (City), PostalCodeNumber (Zip Code) and Thoroughfare (Street Name and Number). For an example see: http://maps.google.com/maps/geo?q=1%20Infinite%20Loop,%20Cupterino,%20Ca. This is a geocode requst for Apple's Headquarters which has an address of 1 Infinite Loop, Cupterino, CA 95014.

Voltin
  • 158
  • 1
  • 10
  • Because I am "new" user it would only let me post 1 link. Here is the rest of my post: For more information please read over the Google Maps Geocoding API documentation which is located at http://code.google.com/apis/maps/documentation/geocoding/index.html – Voltin Feb 13 '10 at 05:01
  • there is also sub administrative name "Santa Clara" whats that stand for? – Basit Feb 15 '10 at 06:30
  • In the US SubAdministrativeAreaName is usually the county name (parish name for Louisiana). It might vary in other parts of the world, but it usually is the governing body one step higher than the city governement. – Voltin Feb 15 '10 at 16:06