Is it possible to calculate distance on GeoDjango in a SELECT statement?
- by alex
I am using MYSQL.
I have a table with 1 column, a Point field.
I want to SELECT all rows that have a point with a distance less than 50 meters of my given point. Simple enough, right? Below is how it's done in RAW SQL. But of course, I want to use GeoDjango to do this.
cursor.execute("SELECT * FROM project_location WHERE\
(GLength(LineStringFromWKB(LineString(asbinary(utm), asbinary(PointFromWKB(point(%s, %s)))))) < 50)\