Dear reader,

Is there anyone who can tell me how I can pinpoint exactly what the
city name of a http geocode result is?

For example, when I run:

http://maps.google.com/maps/geo?q=allston,us&output=xml&sensor=false&key=abcdefg

This results in the following placemark:

<Placemark id="p1">
<address>Allston, Massachusetts, USA</address>
-
<AddressDetails Accuracy="4">
-
<Country>
<CountryNameCode>US</CountryNameCode>
<CountryName>USA</CountryName>
-
<AdministrativeArea>
<AdministrativeAreaName>MA</AdministrativeAreaName>
<AddressLine>Allston</AddressLine>
</AdministrativeArea>
</Country>
</AddressDetails>
-
<Point>
<coordinates>-71.1309800,42.3503400,0</coordinates>
</Point>
</Placemark>

Right. <AddressLine> seems to be the city name. Next.

http://maps.google.com/maps/geo?q=faro,es&output=xml&sensor=false&key=abcdefg

Result:

<Placemark id="p1">
<address>Faro, Portugal</address>
-
<AddressDetails Accuracy="4">
-
<Country>
<CountryNameCode>PT</CountryNameCode>
<CountryName>Portugal</CountryName>
-
<SubAdministrativeArea>
<SubAdministrativeAreaName>Faro</SubAdministrativeAreaName>
-
<Locality>
<LocalityName>Faro</LocalityName>
</Locality>
</SubAdministrativeArea>
</Country>
</AddressDetails>
-
<Point>
<coordinates>-7.9351130,37.0153597,0</coordinates>
</Point>
</Placemark>

Hmmm... Instead of <AddressLine>, the city is now in <LocalityName>.
Next:

http://maps.google.com/maps/geo?q=nijmegen,nl&output=xml&sensor=false&key=abcdefg

Result:

<AddressDetails Accuracy="4">
-
<Country>
<CountryNameCode>NL</CountryNameCode>
<CountryName>The Netherlands</CountryName>
-
<AdministrativeArea>
<AdministrativeAreaName>Gelderland</AdministrativeAreaName>
-
<Locality>
<LocalityName>Nimègue</LocalityName>
</Locality>
</AdministrativeArea>
</Country>
</AddressDetails>

Again, the city is listed in <LocalityName>. However, Nimègue is not
the actual city name in English, it should be Nijmegen, Nimègue is
French. bug. Strange thing is, when I input this:

http://maps.google.com/maps/geo?q=nijmegen,nijmegen,nl&output=xml&sensor=false&key=abcdefg

The result is

<Placemark id="p1">
<address>Nijmegen, Nimègue, The Netherlands</address>
-
<AddressDetails Accuracy="4">
-
<Country>
<CountryNameCode>NL</CountryNameCode>
<CountryName>The Netherlands</CountryName>
-
<AdministrativeArea>
<AdministrativeAreaName>Gelderland</AdministrativeAreaName>
-
<Locality>
<LocalityName>Nimègue</LocalityName>
-
<DependentLocality>
<DependentLocalityName>Nijmegen</DependentLocalityName>
</DependentLocality>
</Locality>
</AdministrativeArea>
</Country>
</AddressDetails>
-
<Point>
<coordinates>5.8586510,51.8416922,0</coordinates>
</Point>
</Placemark>

Right... Now we get the right name in <DependentLocalityName>.
However, both requests respond with an Accuracy of 4, where the 2nd
one is obviously more accurate.

Then there are others... Sometimes the city is in
<AdministrativeArea>, sometimes in <SubAdministrativeArea>. Sometimes
the <SubAdministrativeArea> is a childnode of <AdministrativeArea>,
sometimes it is not, and then it is a direct childnode of <Country>.

In other words, it's prety much impossible to grab the correct city
name for a list of input strings, unless I am missing something here.

Please enlighten me?

Kind regards,
Tjeerd

--~--~---------~--~----~------------~-------~--~----~
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