Re:Ask HN: Please help and review my weekend project. Geosay...
by stewsnooze on Wednesday July 14, 2010 @08:33AM
(#1514369)
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
Re:Ask HN: Please help and review my weekend project. Geosay...
by stewsnooze on Wednesday July 14, 2010 @08:52AM
(#1514402)
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.
Re:Ask HN: Please help and review my weekend project. Geosay...
by djb_hackernews on Wednesday July 14, 2010 @09:58AM
(#1514550)
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?
Re:Ask HN: Please help and review my weekend project. Geosay...
by dansingerman on Wednesday July 14, 2010 @10:47AM
(#1514701)
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.
Re:Ask HN: Please help and review my weekend project. Geosay...
by djb_hackernews on Wednesday July 14, 2010 @10:58AM
(#1514741)
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.
Re:Ask HN: Please help and review my weekend project. Geosay...
by dansingerman on Wednesday July 14, 2010 @11:16AM
(#1514810)
To be honest I can see absolutely no reason why you can't use floats as you describe and < , >. Depending on what you are doing it may be a little tricky due to lat/longs being angular values, but over small distances I think this can be largely ignored. (In geosay we have some front end code that sorts out the niceties of the angular stuff)
Re:Ask HN: Please help and review my weekend project. Geosay...
by dansingerman on Wednesday July 14, 2010 @08:21AM
(#1514346)
We use mongodb as the backend datastore. It has built in location searching which so far has worked really well.
Re:Ask HN: Please help and review my weekend project. Geosay...
by srjk on Wednesday July 14, 2010 @09:00AM
(#1514416)
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 :)
Re:Ask HN: Please help and review my weekend project. Geosay...
by dansingerman on Wednesday July 14, 2010 @09:09AM
(#1514433)
According to http://www.mongodb.org/display/DOCS/Sharding production ready sharding should be available this month.
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.