
WikiMedia's Geo IP Lookup JSONP call - jamesjyu
http://geoiplookup.wikimedia.org/
======
neilk
Hey folks, just FYI, I work there and this is not intended to be a public API
for anyone to use. As others have pointed out, it's trivial to set up such a
service yourself anyway.

I know the security-minded among you are going to start complaining that it
would be easy to add a nonce, but we'd rather avoid that. Our strategy is to
serve virtually everything from cache.

------
njl
Doing the IP lookup yourself isn't very hard. The nginx HttpGeoIPModule[1]
will do a lookup on the MaxMind databases for you. I used it in my weekend
hack, <http://spotwoo.com>. Doesn't take very long to set up, very easy to
use.

[1] <http://wiki.nginx.org/HttpGeoIPModule>

------
nl
Interestingly, the latest version of Google AppEngine automatically geolocates
every request (to the country level anyway)

 _All user request have an X-AppEngine-Country header which contains the
ISO-3166-1 alpha-2 country code for the user, based on the IP address of the
client request._

(from Version 1.5.1
[http://code.google.com/p/googleappengine/wiki/SdkReleaseNote...](http://code.google.com/p/googleappengine/wiki/SdkReleaseNotes))

------
crescentfresh
The payload is not JSONP and strikes me as a bit impractical:

    
    
        Geo = { /* object literal */ }
    

I assume this service is meant to be consumed via <script> tag injection.
Without a JSONP-style callback parameter, what are consumers to do, inject-
then-poll until a "Geo" object is found in the global scope?

~~~
judofyr

        <script src="http://geoiplookup.wikimedia.org/"></script>
        <script>geoloaded()</script>
        </body></html>

~~~
crescentfresh
D'oh!

------
tybris
That's trivial to set up yourself with Maxmind's GeoLite Database.

<http://www.maxmind.com/app/geolitecity>

------
abava
It is not JSONP. You have to analyze JavaScript variable:
<http://servletsuite.com/geoip.htm>

------
qeorge
GeoPlugin.net has a city-level, free version of this that's actually intended
for public use:

<http://www.geoplugin.net/json.gp>

Other formats here: <http://www.geoplugin.com/webservices>

Have been using it in production now for several months, works great.

------
travelemployee
I actually implemented a lucene search index in case you might want to do it
in lucene...

[https://github.com/krickert/IPAddressZipCodeStateCountryLuce...](https://github.com/krickert/IPAddressZipCodeStateCountryLuceneJavaSearch)

It downloads one of the many free DBs of IP addys and makes it into an index.
You can do geo spatial searching APIs with IP addys.. Fun stuff.

------
leecn
If anyone wants something similar I built a version of this a few weeks ago:
<https://github.com/contrast/geoip_sinatra>

It's a sinatra app which uses the MaxMind data, typically responds in < 1ms,
and it has caching built in (if you deploy it to heroku).

------
Inufu
Not very accurate for me. Wrong by about 400km. (that's basically from one end
of my country to the other end)

~~~
harisenbon
Same for me as well. I'm being detected all the way in another prefecture.

I find it strange that depending on the device, that I will be detected in
different areas (even within the same service).

For example: Google Maps says I'm at a park about a 10 minute drive from my
current location. But if I view the mobile version of it on my iPod, it can
find me to the room of the building I am in.

Anything that's not google or apple puts me in Hamanako, which is a 2 hour
drive on the expressway.

------
aaronharder
Cool. But what are the terms of use around this one?

------
dermatthias
been there, done that: <http://ip.beached.org> ;)

~~~
lost-theory
But that's not JSONP.

~~~
dermatthias
Oh, that is correct. Sorry, I need to read the headline more carefully. Missed
the 'P'.

------
VMG
Which method are they using?

~~~
_delirium
Unless it's changed recently (I haven't followed the discussion since last
year) it's using the free version of the MaxMind IP->city database
(<http://www.maxmind.com/app/geolitecity>).

I can't seem to find the relevant mailing list threads, but here's some
evidence of ad-hoc accuracy testing last August:
<http://meta.wikimedia.org/wiki/MaxMindCityTesting>

