Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 6 years ago.
I have thousands of IP addresses of visitors to my site, what tools can I use to convert these into lat/lng coordinates? I will then be able visualise the data on a map with filters for further demographics gathered.
For one of my sites I made use of maxmind's free geolite country database which can be downloaded here: http://www.maxmind.com/app/geolitecountry
They also provide a city level version which includes the long/lat: http://www.maxmind.com/app/geolitecity
but note that the accuracy on the free version is a lot lower than the paid version.
I suggest using Google Analytics to your problem, but if you want to try yourself here is a starting point:
Take a look at this link http://www.geoplugin.net/php.gp, you get a full list of details about that ip address position, including latitude and longitude.
It is not that acurate but it works, and I use it. Here is a php script actually in use :
<?php
$ip_addr = $_SERVER['REMOTE_ADDR'];
$geoplugin = unserialize( file_get_contents('http://www.geoplugin.net/php.gp?ip='.$ip_addr) );
if ( is_numeric($geoplugin['geoplugin_latitude']) && is_numeric($geoplugin['geoplugin_longitude']) ) {
$lat = $geoplugin['geoplugin_latitude'];
$long = $geoplugin['geoplugin_longitude'];
}
echo $ip_addr.';'.$lat.';'.$long;
?>
You can see it working at http://whateverhappens.org/ip-addr/
And that a look at the Geoplugin website examples.
this might also help https://web.archive.org/web/1/http://articles.techrepublic%2ecom%2ecom/5100-10878_11-6103179.html
http://www.telize.com and http://www.iptolatlng.com both provide solutions in JSON