IP geocoding in Google App Engine

608 views
Skip to first unread message

Eduardo Raad

unread,
Jul 7, 2008, 5:30:24 PM7/7/08
to Google App Engine
I want to do IP geocoding on my GAE application but failed to find a
compatible solution. There are some like MaxMind's but those depend on
a c library + local database, which would require a bit of work to
migrate to GAE.

Has anybody done something like that?

Thanks!

Chris L

unread,
Jul 8, 2008, 4:57:11 PM7/8/08
to Google App Engine
I looked into this a while back & thought it would be straightforward
to load their CSV data. In the model, have a property for the
beginning of the IP address range. Then to look up an IP address, get
the object with the highest value that is less than or equal.

Memcache ought to work well.

If you're looking for actual code I haven't written any yet. So,
consider my idea highly suspect.

Eduardo Raad

unread,
Jul 10, 2008, 12:33:44 AM7/10/08
to Google App Engine
Sounds like a good solution. I will test it out and let you know.

On Jul 8, 3:57 pm, Chris L <clun...@gmail.com> wrote:
> I looked into this a while back & thought it would be straightforward
> to load their CSV data. In the model, have a property for the
> beginning of the IP address range. Then to look up an IP address, get
> the object with the highest value that is less than or equal.
>
> Memcache ought to work well.
>
> If you're looking for actual code I haven't written any yet. So,
> consider my idea highly suspect.
>
> On Jul 7, 5:30 pm, Eduardo Raad <eduardor...@gmail.com> wrote:
>
> > I want to do IPgeocodingon my GAE application but failed to find a

julian.amaya

unread,
Jul 9, 2008, 11:02:13 PM7/9/08
to Google App Engine
I've found there is a free web service at GeoBytes...

http://www.geobytes.com/IpLocator.htm?GetLocation&template=json.txt&ipaddress=203.30.195.10

with a simple url fetch you should be on your way soon

Hope that helps :)

On 7 jul, 16:30, Eduardo Raad <eduardor...@gmail.com> wrote:
> I want to do IP geocoding on my GAE application but failed to find a
> compatible soluition. There are some like MaxMind's but those depend on

niklasr

unread,
Jul 10, 2008, 2:42:52 AM7/10/08
to Google App Engine, Alex Hultmark, Km, Otto Dandenell, Shankar Gopinath, Göran E Larsson, Kyriakos, ulf.wen...@swedenisland.se, c.a...@tritelum.com, Jörgen Bang, sta...@tomtebo.org, Peder Linder
http://classifiedsmarket.appspot.com i e www.koolbusiness.com
geocodes
<br>Country Code:
<script language="JavaScript">document.write(geoip_country_code());</
script>
<br>Country Name:
<script language="JavaScript">document.write(geoip_country_name());</
script>
<br>City:
<script language="JavaScript">document.write(geoip_city());</script>
<br>Region:
<script language="JavaScript">document.write(geoip_region());</script>
<br>Latitude:
<script language="JavaScript">document.write(geoip_latitude());</
script>
<br>Longitude:

<script language="JavaScript">document.write(geoip_longitude());</
script>

and reverse geocodes:

var reversegeocoder = new GReverseGeocoder(map);
GEvent.addListener(reversegeocoder, "load",
function(placemark) {
document.getElementById("message").innerHTML = placemark.address
}
);
The map should zoom to your location. We store geo coordinate for each
announcement and the map zooms the this location.The code is available
as a 1 mb zip file from my home page http://niklasro.googlepages.com
We'd rather do this serverside believing this would improve response
time.But the GeoIP C library is probably not available with the GAE,
so our lookups are with javascript.
Regards,
Niklas

Andy Warner

unread,
Jul 10, 2008, 5:01:40 PM7/10/08
to Google App Engine
If you want a really quick and simple approach using urlfetch, you can
get country mappings by hitting:

http://abusebutler.appspot.com/loc/<ip>

e.g.
http://abusebutler.appspot.com/loc/162.112.224.4

It uses the hostip.info geoDB with apphosting caching entries for up
to 90 days.

Eduardo Raad

unread,
Jul 14, 2008, 8:02:37 PM7/14/08
to Google App Engine
Thank you guys! I will go with the urlfetch option!

On Jul 10, 4:01 pm, Andy Warner <andy.war...@gmail.com> wrote:
> If you want a really quick and simple approach using urlfetch, you can
> get country mappings by hitting:
>
> http://abusebutler.appspot.com/loc/<ip>
>
> e.g.http://abusebutler.appspot.com/loc/162.112.224.4
Reply all
Reply to author
Forward
0 new messages