Center Google Map Based on geocoded IP

By : Eeyore

Basically whenever someones opens up my (Google) map I want it default to their approximate location.

Is there an easy way to do it with Google's API or do I have to write a custom code (this is python based app)?

By : Eeyore


Per the docs, just map.setCenter(new GLatLng(37.4419, -122.1419), 13); or whatever other coordinates. Doing it in the page's Javascript is normally preferred.

If you mean translating an IP to lat and long, I don't think the Google API supports that, but there are other web services that do, such as maxmind, hostip, and many, many others. I don't know which one(s) to recommend -- try out a few, would be my suggestion!

If the user uses FireFox 3.5/google gears, you can retrieve the lat and lng from the browser itself. You'll find details on another stackoverflow post here

This video can help you solving your question :)
By: admin