I want to have a radius based distance search. To do this, I want to create a buffer around a point object so that I can filter objects that are inside this buffer, a method that I learned based on a google groups post.
I want to use latitude and longitude in my model definition so that I can easily put the information into my google map later:
class Thing: latitude = models.FloatField() longitude = models.FloatField()
The only problem is trying to filter results based on lat / lon coordinates:
>>> lat = 37.7762179974 >>> lon = -122.411562492 >>> from django.contrib.gis.geos import Point >>> pnt = Point(lat, lon) >>> buf = pnt.buffer(0.0001)
How can I do something like this?
qs = Thing.objects.filter((lat, long)__intersects=buf)