How to use Django for efficient geolocation?

I want to do the following.

I want to create an application that does the following

  • Restaurants are located at the address where they are located.
  • Person A opens the application and sees how many miles each restaurant is in its current location, sorted by nearest.

How can I do this in the most efficient way?

If the restaurant gives me its address, should I convert this address to longitude / latitude points, and then somehow use it to get the distance from the person. Current location? But how can I do this so efficiently that if there are 1000 addresses in the database, I can sort all these addresses efficiently - closest to person A first - without taking up too much time? Thank!

I am using django.

+5
source share
2 answers

Take a look at GeoDjango and PostGIS .

GeoDjango will provide you with the ability to store geoinformation and search for distances .

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

+1
source

You can simply use the Cloudmade Geocoding API to find a restaurant from the address provided.

And then you use the Cloudmade Routing API to find the distances.

0
source

All Articles