views:

492

answers:

3

Can the API for Google Maps be used to retrieve the latitude and longitude for a given Postal Code or City+Region combination for foreign countries such as The United Kingdon, France, Italy, Japan, Australia etc. ?

I am working on a project that requires local search results. For domestic users I retrieve their lat/lon via a U.S Zip Codes Table in our database. It does not involve showing any maps, just results of other users who are in their area via a radius formula based on lat/lon values. For foreign users' local search results: I am just showing results based on matching City Name.

At the moment non-U.S users lat/lon is being retrieved via PHP GeoIP data. I'd like to be able to retrieve more accurate values depending on the city+region or postal code the user provides.

I am considering getting postal code tables (which have lat/lon fields) for other countries. Or is the Google Map API idea a better solution?

+4  A: 

I have found the results from the Google Maps Geocoder to be pretty good.

To test out your foreign postcodes or addresses (without writing any code), just attach the country name to the string and try it out in the google maps search box.

Or, you can implement the lookup pretty quickly in Javascript:

geo = new GClientGeocoder ();
geo.getLatLng("2337, Australia", function (point) {
        GLog.write(point.lat() + "," point.lng());
    });
Cannonade
This seems like the best step forward. Heading out for a late dinner and then I'll give this a go. Thank you.
Seth
+2  A: 

I've previously used Google Maps for its geocoding, works well and can work for anywhere in the world.

Use the GClientGeocoder from google and use the 'setBaseCountryCode(countryCode:String)' method to set it to the countries top-level domain (http://en.wikipedia.org/wiki/CcTLD)

RodH257
A: 

Mapping from Postal codes to lat/lon pairs: GeoNames Postal Code Database

Also available as a GeoNames webservice...

Stobor