views:

153

answers:

1

i want to parse the addresses from google gecoding 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.

+2  A: 

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
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
there is also sub administrative name "Santa Clara" whats that stand for?
Basit
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