views:

861

answers:

1

Has anyone been able to get geo-location based on a person's IP to work using Google Maps API v3 JavaScript?

It seems to me that even the google provided example doesn't work.

http://gmaps-samples-v3.googlecode.com/svn/trunk/commonloader/clientlocation.html

Question:

  1. Does this example work for anyone?

  2. How do I get geolocation based on a person's IP to work using Google Maps API v3?

+3  A: 

Q1: It works from here, and probably from many other locations. However note that geolocation from IP addresses is not a very reliable science. You will be getting the location of your ISP, which can be quite far away, and in addition the IP-to-location databases aren't always up to date with the latest changes, so you might not have any data for a particular IP address -- which is probably what is happening in your case.

MaxMind, which offers a popular IP-to-location database published some statistics on its database:

Q2: The only way to get the geolocation from an IP address through the Google Maps API v3 is by using the same method used in the example you provided. However if you find that any other geolocation database, like MaxMind GeoLite City, is more accurate for your country, you may want to do the geolocation from the IP Addresses yourself, instead of delegating it to Google Maps.

Daniel Vassallo
works from here as well. probably your (OP) location is not in the databases.
dusoft
Works fine for me as well (City level).
Pekka