>It literally says "fork me on GitHub" at the top right.
It din't show up for me either. After a bit of investigating, it looks like Ghostery (and maybe AdBlock Plus too) sees Github ribbon as a tracker and automatically hides it.
For those who don't want their web service to rely on other web services, I recommend MaxMind's lite database, they have a fairly recent downloadable binary of IP to geographic coodinates.
Mine is only 100m away - but then again, that's the location of the old GPO, which is usually used as the local "distance from X" position. I'm not sure about elsewhere, but here in Aus, ['road'] distance from A to B is the distance from A's post office to B's post office.
It picked out a beautiful location for me. I really wish I were there, but I'm in an office park much further north, in Padova, which the one in the story actual nailed down to a few meters.
By the way, Italy is amazingly beautiful isn't it! You can pretty much randomly pick a street view and without too much effort, find some interesting or beautiful scenery.
Honestly, I have been around the block trying to find a decent company that provides either a database or api for looking up a location from an ip address.
It seems like every company from MaxMind to IP2Location and all of the others are accurate for some ip addresses, and severely inaccurate for others. And I think that will only become more and more common as all of the ipv4 addresses run out and there are hundreds to thousands behind the same ip address.
I've even tried crowdsourcing from four different ip to location sources and even then, sometimes all four return different cities and even states for a single ip address.
Is there any company out there that is actually fairly accurate (on a city basis)?
I am guessing this is why companies like Google have sourced their own info.
Geo-locating by IP will always be an imperfect process because it's not actually geolocating the IP, it's geolocating the block owner.
My downtown Toronto office geo-locates as Kansas City in some cases because the org who owns the block is there. And I assume they are not keeping their records up to date as we have a /8 and I think they should be registering a sub-block or whatever it's called..
I would think geolocation would only get better as more people go mobile and their IP address (wifi or 3G) gets pinned to gps coordinates using location aware apps.
Think about how much info google, apple, and others can collect with this, and build a database to sell.
Yeah but those IPs are dynamic and change over time.. Unless the mobile providers (who are often national) restrict IPs to regions, you could have an IP be in one part of the country one week and in another part of the country the next, no?
It's not perfect, but it seems to be good enough for my purposes.
$ip = $_SERVER['REMOTE_ADDR'];
$ua = $_SERVER['HTTP_USER_AGENT'];
$ch = curl_init();
// set url
curl_setopt($ch, CURLOPT_URL, "freegeoip.net/csv/" . $ip);
//return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// $output contains the output string
$ip = curl_exec($ch);
// close curl resource to free up system resources
curl_close($ch);
$array = explode(',', $ip);
Author of freegeoip.net here. It uses the db from MaxMind.
Worth mentioning that the system is not only free but also open source, available at github.com/fiorix/freegeoip (currently written in Go)
What is the database behind all these geo IP providers? I see many APIs providing same functionality and results are the same. Is this database purchased from somewhere every time you want to do this?
I recently noticed that you could create your own "IP -> countrycode" lookup system by using the delegation tables provided by arin/ripencc/afrinic/...
Simple and cool! I'm starting to learn python so I'll definitely be looking through the source, thanks for posting, flask looks like a nice little framework to get started on
In general, the accuracy of geolocation is at 70-80% at the city level. We have researched and compare the data from several providers such as IP2Location, Maxmind, Geobytes and so on. The IP address can be freely reallocated to any postcodes within one or multiple cities so we think that the 70-80% is acceptable.
48 comments
[ 2.4 ms ] story [ 92.9 ms ] threadIt din't show up for me either. After a bit of investigating, it looks like Ghostery (and maybe AdBlock Plus too) sees Github ribbon as a tracker and automatically hides it.
For those who don't want their web service to rely on other web services, I recommend MaxMind's lite database, they have a fairly recent downloadable binary of IP to geographic coodinates.
I'm in a rural area, whereas you are most likely in a more metropolitan location.
https://www.dailycred.com/api/info.json
This returns the current requester's location, device, and language settings. Or you can just look for location for a specific ip like so:
https://www.dailycred.com/api/local.json?ip=67.188.232.131
1: https://panopticlick.eff.org/
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
https://maps.google.com/maps?q=42.83330000000001,12.83330000...
By the way, Italy is amazingly beautiful isn't it! You can pretty much randomly pick a street view and without too much effort, find some interesting or beautiful scenery.
It seems like every company from MaxMind to IP2Location and all of the others are accurate for some ip addresses, and severely inaccurate for others. And I think that will only become more and more common as all of the ipv4 addresses run out and there are hundreds to thousands behind the same ip address.
I've even tried crowdsourcing from four different ip to location sources and even then, sometimes all four return different cities and even states for a single ip address.
Is there any company out there that is actually fairly accurate (on a city basis)?
Geo-locating by IP will always be an imperfect process because it's not actually geolocating the IP, it's geolocating the block owner.
My downtown Toronto office geo-locates as Kansas City in some cases because the org who owns the block is there. And I assume they are not keeping their records up to date as we have a /8 and I think they should be registering a sub-block or whatever it's called..
But there you go.
Didn't mean to start a whole thing..
Think about how much info google, apple, and others can collect with this, and build a database to sell.
It's not perfect, but it seems to be good enough for my purposes.
It is built on Nginx + Lua so it has very minimal overhead.
Source code is on GitHub : https://github.com/fcambus/telize
It might not be very accurate, but it's a fun little exercise: http://blog.marc-seeger.de/2013/09/07/ip-to-countrycode-with...
http {
}then in /etc/nginx/perl/myip.pm :
---
package myip;
use nginx;
sub handler {
}1;
---