Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Geocode an IP address? [closed]

Does anyone know of any open RESTful API that I can call to geocode a user's IP to the latitude and longitude?

Ideally, it would be something like: http://google.com/geocode_api/?IP=1.2.3.4 and it would return the latitude and longtitude.

like image 451
Tim Avatar asked Jul 12 '10 21:07

Tim


People also ask

Can you geocode an IP address?

Geocoding is the process of translating an IP address to a physical location. Geocoding is an imprecise science. It works by looking up an IP address in a database. Databases use a variety of information sources to link IPs and locations, such as tracing web traffic and ownership of IPs.

Why is my IP geolocation wrong?

If you IP geolocation is wrong, it is because the IP database has mapped your location incorrectly. IP geolocation database providers do updates frequently and your location may be fixed in the next update.

Is geolocation IP address accurate?

IP-based geolocation services provide 55 percent to 80 percent accuracy for a user's region or state. And they provide 50 percent to 75 percent accuracy for a user's city. In practice, the actual accuracy may vary from provider to provider and depending on the location of the device.


1 Answers

Another free REST API with city accurate information would be http://freegeoip.net Requests are fairly straight forward. You would use something like

http://freegeoip.net/{format}/{ip_or_hostname} 

to geocode an IP address, where format can be csv, xml or json. Their website has all the details.

[UPDATE:] FreeGeoIP.net was not continuously available in the past as a public service. The software was, however, always open source and is available on Github. It's fairly easy to get your local installation running using Docker, if you need a highly reliable service or your use case exceeds the current quota of 15.000 requests/hour.

like image 120
Stefan Haberl Avatar answered Sep 21 '22 16:09

Stefan Haberl