开发者

Google Maps: Geolocation assistance

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开发者_Python百科 me:

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

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


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 want 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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜