Geo Location extracted from visitors ip address

Tim Chase python.list at tim.thechases.com
Sat Jul 6 13:20:16 CEST 2013


On 2013-07-06 11:41, Νίκος Gr33k wrote:
> you know when i go to maps.google.com its always find my exact city
> of location and not just say Europe/Athens.
> 
> and twitter and facebook too both of them pinpoint my _exact_
> location.
> 
> How are they able to do it? We need the same way.

A couple possibilities:

1) using the aforementioned HTML5 location API, your device may be
tattling on where you are.  Are you browsing from a smart-phone or
other device with a GPS built in?

2) at some point in the distant past, you told Google where you are,
and it has dutifully remembered that.  Try using an alternate browser
in a new session (Firefox has the ability to create a new profile;
Chrome/Chromium should have the ability to start up with a virgin
profile; I can't say for Safari or IE) and see if Google suddenly
lacks the ability to locate you

3) Google has a better IP-to-location map database than you have.
You might have to pay real money for such functionality.  Or, you
might have to use a different library, as the IP-to-location database
that I linked you to earlier has both an "IP to Country" and an "IP
to City" database.  Note that this is often wrong or grossly
inaccurate, as mentioned in other threads (geolocation by IP address
often puts me in the nearest major city which is a good 45min drive
away, and if I just visit Google maps with a fresh browser, it just
shows me the state, TX, which is a ~13hr drive across, if done at
65mph the whole way)

-tkc







More information about the Python-list mailing list