geolocationipfreegeoip

Geolocation using IP


I have been trying to find a tool to locate my position using my computer ip.

I have tried some web tools such as http://geoiplookup.net/and https://geoiptool.com/ and some developer tools like freegeoip.net, in which I'm more interested.

the fact is: geolocation is way off in all of them, at least where I'm located (South America, Brazil), all pointing to the same wrong location.

why is it so?

I have tried this piece of code:

    send_url = 'http://freegeoip.net/json'
    r = requests.get(send_url)
    j = json.loads(r.text)
    lat = j['latitude']
    lon = j['longitude']

    return (lat, lon)

but since it uses a wrong ip it returns some strange lat/lgn, miles away from me.

1) can I pass my exact ip as an argument in the code above?

2) is there any other tool for finding out my precise lat, lng, other than googlemaps?


Solution

  • IP address geolocation is relatively less accurate compare to other geolocation methods such as GPS or WiFi MAC address. The reason is due to frequent reallocate of IP address by ISP.

    Reference: http://www.geolocation.com

    Back to your questions.

    1) The API should auto detect your IP address and return you the estimated location

    2) You could not find your precise lat and longitude without enable the GPS