At this time I am using raw SQL to find people within 500 meters from the current user.
cursor.execute("SELECT user_id FROM myapp_location WHERE\ GLength(LineStringFromWKB(LineString(asbinary(utm), asbinary(PointFromWKB(point(%s, %s)))))) < %s"\ ,(user_utm_easting, user_utm_northing, 500));
Wouldso would I actually do this in GeoDjango? It will get just a little tiring writing custom SQL everywhere.
Well presuming you will find the appropriate model,
from django.contrib.gis.db import models class User(models.Model): location = models.PointField() objects = models.GeoManager()
it might seem like:
But observe that such distance lookups aren't based on MySQL.