Reputation: 197
I'm building a django app that requires to display (on google map) items near the user current location. (ie. the nearest coffee shop kind of request). I haven't decided how I will capture those items' location in db. The requirements aren't final but I'm guessing the user will want to sort by distance, etc. My question is what solution should I look into? I looked at geodjango but it seems to be an overkill. Could you please tell me what solution you would use and why?
Thanks everyone!
Upvotes: 2
Views: 1413
Reputation: 3012
You will need to use RDBMS like MySQL or postgresql. Then, create your objects (e.g: cafeshops) with latitude and longitude as flout. Get the user's latitude and longitude and look it up via sin and cos functions.
You will need to write a raw sql query to look up objects based on their latitude and longitude.
Read this: http://www.scribd.com/doc/2569355/Geo-Distance-Search-with-MySQL
Take a look at this: Filter zipcodes by proximity in Django with the Spherical Law of Cosines
and this: latitude/longitude find nearest latitude/longitude - complex sql or complex calculation
Upvotes: 2