center map depending on user ip address

744 views
Skip to first unread message

Florent2

unread,
Jul 2, 2010, 4:03:26 PM7/2/10
to Google Maps JavaScript API v3
Hello,

With the Google Maps JavaScript API, is there a way to center the map
around the user location, depending on its IP address?

Thanks!

Mario Firmino

unread,
Jul 3, 2010, 5:20:05 AM7/3/10
to google-map...@googlegroups.com

Irina Borozan

unread,
Jul 3, 2010, 10:52:52 AM7/3/10
to Google Maps JavaScript API v3
Hello

You will first have to find out the geographical location of the
user's ip address. You can use the geolocation api from google (http://
code.google.com/apis/gears/api_geolocation.html) or another
geolocation service (there are several online which you can use). And
then just use those coordinates as your map's center.

Hope this helps!

William

unread,
Jul 3, 2010, 10:25:47 PM7/3/10
to Google Maps JavaScript API v3
and another method is the Ajax API loader which can give you location
to the city based on IP:

http://code.google.com/apis/ajax/documentation/#ClientLocation

...

Florent2

unread,
Jul 6, 2010, 6:10:10 PM7/6/10
to Google Maps JavaScript API v3
Thanks to all!
Reply all
Reply to author
Forward
0 new messages