Just did a cursory read of the geodjango documentation for the first time...the querysets being returned from "all()" (or really, just objects) need to be GeoQuerySets which have a default "position" as part of their specification (I think), also such modules need to inherit from the geo version of model.Model AND use a special GeoManager. So, once you use that special manager, there is a point, boundary or area tat all the geo functions refer to.
On Wednesday, December 12, 2012 1:15:44 PM UTC-8, mikegolf wrote: > > 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/-/QEpUbMZqn60J. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.