Google Maps has a fantastic geolocation API that attempts to translate text representing a location into hard and fast latitude/longitude coordinates. A great service that is in use by many websites, not least Google Maps itself.
For web developers who use the service from their servers, there’s an extra level of complexity to deal with - the geocoding API biases its results towards the country from which the request was made. So “Perth” could be the Scottish town to a user in Britain or the Western Australian capital if the request came from an IP down-under. When your servers are located in one country this can limit their usefulness to an international audience.
The solution is to call the API from an appropriate version of Google Maps, so if your server receives a request from a Japanese IP, call the Google API via maps.google.co.jp. Nice and easy, eh?
No, not quite, because not every country has its own Google Maps address. I searched for a canonical list of them, but could find nothing, so was forced to use a bit of Perl hackery to try every country domain preceded by “http://maps.google.(|co.|com.)”. These are my results:
| Country | ISO 3166-1 | URL |
|---|---|---|
| USA | US/Default | http://maps.google.com |
| Austria | AT | http://maps.google.at |
| Australia | AU | http://maps.google.com.au |
| Bosnia and Herzegovina | BA | http://maps.google.com.ba |
| Belgium | BE | http://maps.google.be |
| Brazil | BR | http://maps.google.com.br |
| Canada | CA | http://maps.google.ca |
| Switzerland | CH | http://maps.google.ch |
| Czech Republic | CZ | http://maps.google.cz |
| Germany | DE | http://maps.google.de |
| Denmark | DK | http://maps.google.dk |
| Spain | ES | http://maps.google.es |
| Finland | FI | http://maps.google.fi |
| France | FR | http://maps.google.fr |
| Italy | IT | http://maps.google.it |
| Japan | JP | http://maps.google.jp |
| Netherlands | NL | http://maps.google.nl |
| Norway | NO | http://maps.google.no |
| New Zealand | NZ | http://maps.google.co.nz |
| Poland | PL | http://maps.google.pl |
| Russia | RU | http://maps.google.ru |
| Sweden | SE | http://maps.google.se |
| Taiwan | TW | http://maps.google.tw |
| United Kingdom | UK/GB | http://maps.google.co.uk |
Hope you find the list useful, I’ll try to keep it up to date as Google rolls out more servers across the world, so don’t forget to bookmark it.
Do you know of a Google Maps domain that I’ve missed? Leave a comment below.
Creative Commons licensed photo by Hive.
.

