2

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!

Sophian Achiba
  • 197
  • 1
  • 13
  • Take a look over [MongoDB](http://docs.mongodb.org/manual/applications/geospatial-indexes/) – Gocht May 26 '15 at 01:31

1 Answers1

2

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

Community
  • 1
  • 1
Ahmed
  • 2,825
  • 1
  • 25
  • 39