Is there any gmap's api function to concatenate address string from AddressDetails structure?

Posted by Vadim on Stack Overflow See other posts from Stack Overflow or by Vadim
Published on 2010-03-11T19:49:07Z Indexed on 2010/03/11 20:34 UTC
Read the original article Hit count: 1297

Hello! I’am using Google Map’s GClientGeocoder for reversing map coordinates into string address. Exactly as shown in google’s example here http://code.google.com/apis/ajax/playground/?exp=maps#geocoding_reverse

But, I would like to extract LocalityName (place.AddressDetails.Country.AdministrativeArea.Locality.LocalityName) from place.address.

The straight way will be join all AddressDetails elements, excluding LocalityName. However order of the structure elements in final string representation is depends from geographical location.

For example:

Order for Australia city:

ThoroughfareName + “, ” + LocalityName + “ ” + AdministrativeAreaName + “ ” + PostalCodeNumber + “, ” + CountryName

Order for Russian city:

CountryName + “, ” + PostalCodeNumber + “, ” + LocalityName + “, ” +ThoroughfareName

Moreover PostalCodeNumber was not supplied in AddressDetails for the last example.

Please, help!

© Stack Overflow or respective owner

Related posts about google-maps

Related posts about JavaScript