Hacker News new | ask | show | jobs
by DEADBEEF 5812 days ago
How is the geo-IP lookup performed?

It put's my location in rural Algeria (I'm in Nottingham, UK). It does this even if I check the 'share my location with geosay.com' type warning that Firefox provides.

With Chrome & Opera it again puts my location in rural Algeria, however clicking on 'Share location' narrows it down to a map of the whole of the UK (better, but still not too useful).

Saying that, I don't think it's a problem with your site, as clicking on the 'show my location' button (above the streetview guy) in Google maps can't find me either and I'm guessing you're using the same google maps API to do your lookups.

3 comments

On that note, would you mind talking about what you use to store the data, efficiently query it etc?

I am in the nascent phases of developing a location based app, but have gotten stuck in trying to figure out a good way to store the data. Currently cassandra is the top contender.

Check out this code for searching locally with mongo. It doesn't get simpler. Straight from geosay.com

class GeosayController < ApplicationController

  def api

    expires_in 1.minutes, :public => true

    results = Tweet.near(params[:lat].to_f,params[:lon].to_f)

    render :json => results
  end
end

....

class Tweet

  include MongoMapper::Document

  def self.near(lat, lon)

    self.all( :latlong  => {'$near'  => [lat, lon]}, :limit => 30) 

  end
end
We chose mongodb after reading this page http://www.mongodb.org/display/DOCS/Geospatial+Indexing

Before then we were looking at Postgres for its geo stuff and things like cassandra also.

as someone building a location based service, why not just store the lat/long in a table column and query for < >? Is it that much more efficient to use a specialized product?
Our understanding is mongodb should scale to tens of millions of rows better than a SQL database (which would be a nice problem to have)

Once we made the decision to use mongodb, it made sense to use the built in near functionality, rather than roll it ourselves.

Indeed. I am using Django to build my app and a mysql db with 2 float fields for lat/long. GeoDjango and GIS extensions for mysql seemed like over kill, plus I don't really know what I am doing but it seems to work. Django doesn't have very good support for mongo. Well, the django orm.
We use mongodb as the backend datastore. It has built in location searching which so far has worked really well.
thanks for both your replies.

I have used (and liked) mongodb in the past. Horizontal scalability is important and mongo doesn't have a stable release with sharding. Also, this page http://www.mongodb.org/display/DOCS/Sharding+Upgrading+from+... seems empty.

But, the ease of use is really tempting :)

According to http://www.mongodb.org/display/DOCS/Sharding production ready sharding should be available this month.
There are 2 lookups. If you say "yes" to share my location in firefox then it uses the browser's navigator.geolocation functionality. If you say no, it uses MaxMind's geoIP service (see http://www.maxmind.com/)
We try and get a real geo lookup from your browser basically using HTML 5 JS if your browser supports. If you have gears it will fall back to that, if I remember correctly that is!, then it will go to maxmind.com javascript service to try and find you.