If you geocode with getLocations() then you get the address info split
into various fields. In the case of "Barcelona" you get:

  address = Barcelona, Spain
  AdministrativeAreaName = CT
  LocalityName = Barcelona
  SubAdministrativeAreaName = Barcelona
  CountryName = Spain

If you know that you're dealing with Spain, then the autonomous
community would appear to be the AdministrativeAreaName. The "CT" code
doesn't seem to be from any official standard, so you might end up
having to geocode all the autonomous communities to find out what code
Google uses if you want to display the full name. (Or, nor very pretty,
you could throw "CT, ES" back at the geocoder and look at the first word
in the address field, but beware, not all autonomous communities return
a code, some return the name directly.)

You need to write your code as defensively as possible, allowing for
variations in the layout of the AddressDetails that the geocoder
returns. There can be weird variations, depending both on what type of
region the geocoder finds, and changes in geocoder server code. For
example, if you search for "Palma of Majorca", Google think that's a
country (geocoder Accuracy = 1) (!) and countries aren't located inside
AdministrativeAreas, so you don't get told anything about Balearic
Islands.

-- 
Mike Williams
http://econym.org.uk/gmap



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-maps-api?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to