For a Google Maps application, I need to create a query that selects all items in my database that fall within a certain radius from a given latitude/longitude, given the lat/lng of each point. Is there an efficient way to do this in the Django ORM?
The best way I have come up with thus far is to select all points that will fall within a bounding square of that circle (with __range
) and then call a iterative function on all the selected listings to determine whether they really fall in the circle.
My feeling is there might be a more efficient way - how would you do it?
Django has GeoDjango for this
http://docs.djangoproject.com/en/dev/ref/contrib/gis/db-api/#distance-queries
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With