Hi I’m writing an Android lbs game, I need to:
-
store user’s real time position(lat, lon)
-
get users that are near to a given position
I’ve wrote some back-end api with django and mysql(for example, get user name and age by his id).
what’s the best solution to do what I said above (with django/python)?
Should I use a nosql database like redis?
And how should the positions be stored in database so I can quickly get positions that is near to a given position?
Well, I am a enthusiast of Redis, but considering your specific problem, there is a NoSQL database engine that better supports geospatial queries: MongoDB.
I have never used MongoDB, but in conferences I’ve seen people talking about this feature: http://www.mongodb.org/display/DOCS/Geospatial+Indexing
I read through it carefully now, and focused on these main points:
findand/orgeoNearqueries in MongoDB;geoNear(with thesphericalattribute). If this attribute is not used (orfindis), the distance is converted from a fixed value ofmiles per arcdegree.Also a curiosity: the “logo” in the Stack overflow NoSql tag is from MongoDB.