Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Django for effective geolocation?

I want to do the following.

I want to create an app that does the following

  • Restaurants put in the address where they are located.
  • Person A opens up the app and sees the number of miles each restaurant is from his/her present location sorted by nearest.

How can I do this in the most effective way?

If the restaurant gives me their address, should I be converting that address to longitude/latitude points, and then somehow using that to get the distance from the person A current location? But how do I do this so effectively so that if there are 1000 addresses in the database, I can efficiently sort all of these addresses - nearest to person A first- without taking too much time? Thanks!

I am using django.

like image 796
user2237822 Avatar asked Apr 16 '13 21:04

user2237822


1 Answers

Take a look at GeoDjango and PostGIS.

GeoDjango will give you the ability to store geo informations and do distance lookups.

You also could use OSMGeoAdmin or django-location-field to help you easily fill the location fields.

like image 184
caio Avatar answered Oct 20 '22 16:10

caio