I'm doing a distance query between points, and although the documentation says you can specify units, I haven't been able to figure out how to pass that parameter in. It seems to be using degrees be default. This is what I'm doing:
user_point = WKTSpatialElement("POINT(%s %s)" % (lon, lat))
distance_col = Site.center.distance(user_point).label('distance')
sites = db.session.query(Site, distance_col).\
join(Site.stories).\
filter(Site.center.within_distance(user_point, 1)).\
limit(20)
For both within_distance and distance functions, I would like to specify miles if possible.
thanks
Ben.