Google Maps Japan vs. Google Maps US
Using Google Maps to do geocoding of addresses in Japan and the US gives back much different results. Geocoding is when you ask Google Maps for information about an address. For example, you could search for “Empire State Building” and get back the address “Empire State Building, New York, NY 10001, USA” along with it’s longitude and latitude. The Google Maps geocoder is pretty smart about partial and badly formed addresses. Most of the time.
When you request information about an address from Google Maps, you get an XML file back with details such as the longitude, latitude, country code and other goodies. The geocoding for Japanese addresses is pretty limited at the moment, not even returning the prefecture name. Here’s a typical response for an Japanese address from Google Maps (for the address 東京中央区). The URL I use is this (with my API key inserted at the end. Note that you should make any Japanese into HTML entities when coding these URLs)
http://maps.google.com/maps/geo?q=&東京中央区1-1-1&output=xml&key=
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.0">
<Response>
<name>東京中央区</name>
<Status>
<code>200</code>
<request>geocode</request>
</Status>
<Placemark id="p1">
<address>日本東京都中央区</address>
<AddressDetails xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0" Accuracy="1">
<Country>
<CountryNameCode>JP</CountryNameCode>
<AddressLine>東京都中央区</AddressLine>
</Country>
</AddressDetails>
<Point>
<coordinates>139.774877,35.676772,0</coordinates>
</Point>
</Placemark>
</Response>
</kml>
You can see from above that the country code is given in CountryNameCode, as JP. The next line is how Google Maps has stored this address, in the more correct form with Tokyo-to. Note too that if I just search for Tokyo, I can get this response back:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.0">
<Response>
<name>Tokyo</name>
<Status>
<code>200</code>
<request>geocode</request>
</Status>
<Placemark id="p1">
<address>Tokyo, Japan</address>
<AddressDetails xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0" Accuracy="4">
<Country>
<CountryNameCode>JP</CountryNameCode>
<AdministrativeArea>
<AdministrativeAreaName>Tokyo</AdministrativeAreaName>
<Locality>
<LocalityName>Tokyo</LocalityName>
</Locality>
</AdministrativeArea>
</Country>
</AddressDetails>
<Point>
<coordinates>139.824316,35.668554,0</coordinates>
</Point>
</Placemark>
</Response>
</kml>
Now, if I search for a US address, say Shattuck Berkeley, I get much more extended information:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.0">
<Response>
<name>Shattuck Berkeley</name>
<Status>
<code>200</code>
<request>geocode</request>
</Status>
<Placemark id="p1">
<address>Shattuck Ave, Berkeley, CA, USA</address>
<AddressDetails xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0" Accuracy="6">
<Country>
<CountryNameCode>US</CountryNameCode>
<AdministrativeArea>
<AdministrativeAreaName>CA</AdministrativeAreaName>
<SubAdministrativeArea>
<SubAdministrativeAreaName>Alameda</SubAdministrativeAreaName>
<Locality>
<LocalityName>Berkeley</LocalityName>
<Thoroughfare>
<ThoroughfareName>Shattuck Ave</ThoroughfareName>
</Thoroughfare>
</Locality>
</SubAdministrativeArea>
</AdministrativeArea>
</Country>
</AddressDetails>
<Point>
<coordinates>-122.268393,37.872108,0</coordinates>
</Point>
</Placemark>
</Response>
</kml>
Here, I have the state, region and locality information, as well as the country code. If I make the search more exact, searching for 103 Shattuck Berkeley, I get results with an accuracy of 8:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.0">
<Response>
<name>103 Shattuck Berkeley</name>
<Status>
<code>200</code>
<request>geocode</request>
</Status>
<Placemark id="p1">
<address>103 Shattuck Ave, Berkeley, CA 94704, USA</address>
<AddressDetails xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0" Accuracy="8">
<Country>
<CountryNameCode>US</CountryNameCode>
<AdministrativeArea>
<AdministrativeAreaName>CA</AdministrativeAreaName>
<SubAdministrativeArea>
<SubAdministrativeAreaName>Alameda</SubAdministrativeAreaName>
<Locality>
<LocalityName>Berkeley</LocalityName>
<Thoroughfare>
<ThoroughfareName>103 Shattuck Ave</ThoroughfareName>
</Thoroughfare>
<PostalCode>
<PostalCodeNumber>94704</PostalCodeNumber>
</PostalCode>
</Locality>
</SubAdministrativeArea>
</AdministrativeArea>
</Country>
</AddressDetails>
<Point>
<coordinates>-122.268316,37.871167,0</coordinates>
</Point>
</Placemark>
</Response>
</kml>
It looks like the more exact address I provide, the bigger the number in accuracy. The same isn’t true for Japanese addresses. Searching for a certain Tokyo Starbucks in Setagaya gives this response:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.0">
<Response>
<name>東京都 世田谷区 松原 2-46-5</name>
<Status>
<code>200</code>
<request>geocode</request>
</Status>
<Placemark id="p1">
<address>日本東京都世田谷区松原2丁目46−5</address>
<AddressDetails xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0" Accuracy="1">
<Country>
<CountryNameCode>JP</CountryNameCode>
<AddressLine>東京都世田谷区松原2丁目46−5</AddressLine>
</Country>
</AddressDetails>
<Point>
<coordinates>139.650077,35.669038,0</coordinates>
</Point>
</Placemark>
</Response>
</kml>
The accuracy here is only 1, although the address is specific to the building. Again you can see that no details other than country code are given, although the city is obviously Tokyo.
For now, the only way to get extended information from Japanese addresses is to use the address itself. Luckily, Japanese addresses are fairly standard, and getting it to at least a city level is easy enough. Another problem with Japanese addresses is that the Google Maps geocoder isn’t as forgiving about badly formed addresses. One example of this that’s I’ve run into lately is when an address has extra information at the end, such as floor number or non-standard building names. For example, this address of a Starbucks in Tokyo:
東京都 港区 赤坂 1-12-32 アーク森ビル 1F
will return a 602, one of the error codes in Google Maps geocoding. But removing the end of the address to make this:
東京都 港区 赤坂 1-12-32
will give me a 200 code (success) with the address returned as this:
日本東京都港区赤坂1丁目12−32
(Note that Google Maps uses double byte numbers in their return). The problem here is that there’s no way to know how much of the address you have to cut off to make it work. If the address is separated by spaces (like the Starbucks addresses I’ve been working with) then you can write a function to chop off everything past the last space and try the geocode again. If not, you have to learn to cut off one kanji at a time, perhaps by encoding the kanji to html entities and using the semicolon as a delimiter. The previous return gave me an accuracy of 1, so the other thing to do is keep the matched address and check your results to see how accurate the location returned really was. Recently, using these techniques to geocode 700 Starbucks locations, I found about 20 which came back with location which were too general to use. Addresses like these will need to be checked by hand.


No Comments Yet