Blog Archive for November 25, 2011

GeoDjango Querying Points Within Distance

November 25, 2011

I wanted to produce a list of bands that are near an origin point, ordered by distance. See http://drumcoder.co.uk/blog/2011/nov/18/adding-geodjango-existing-project/ for details of my model.

Here's the view code used. This selects an origin point (the band with id 1) and then selects all bands that are within 10 miles of …