GeoDjango annotate distance
Hi,
I've recently started learning GeoDjango and I'm a bit confused.
There's a GeoQuerySet method "distance" which annotates each object with the distance to the given point, like that:
pnt = 'POINT(coords... coords ...)'
MyModel.objects.all().distance(pnt)
but what field of the object does it take to calculate the distance?
I'd like to do "classic" annotation, like that:
MyModel.objects.all().annotate(distance_to_pnt = Distance('location_attribute_of_MyModel', pnt))
any tips?
thanks
mg
-- You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/HsymmdttS_sJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home