views:

332

answers:

2

For some reason, the following Google Maps v3 same does not geolocate my IP

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

But the following link that using Google Maps v3 + Google Gears can geolocate me:

  1. gmaps-samples-v3.googlecode.com/svn/trunk/geolocate/geolocate.html

Question: Any ideas why #2 works but #1 doesn't?

+1  A: 

I believe that Gears uses a different algorithm to geocode the IP. In my case the non-gears version places my location in a different city far from my actual location (as do most other websites that geocode IPs), whereas the gears version places the marker right on top of my house.

Edit: You may also why to try the v2 version of the Google Maps IP geocoder (http://gmaps-samples.googlecode.com/svn/trunk/clientlocation/clientlocation.html), just so that we can rule our v2 vs v3 bugs/issues.

Voltin
A: 

The google.loader.ClientLocation, which your first link uses, attempts to geocode your location based on your IP address. If that fails it won't return an address.

The Google Gears version uses several different methods, and I'm not sure what all of those are. The specs say it uses both on-board methods (like GPS if you're using a phone with GPS) or network location services.

If you're not accessing from a phone then perhaps the Gears version is using a better location service

Bob