Hi,

I want to be able to use spatial functions to annotate a queryset,
then aggregate based on those annotation, for example:

>>> r = Resultant.objects.values('ownership')
>>> r1 = r.area()

AttributeError: 'GeoValuesQuerySet' object has no attribute 'area'

or

>>> r = Resultant.objects.area()
>>> r1 = r.values('ownership)
>>> r2 = r.annotate(sum_area=Sum(area))

NameError: name 'area' is not defined

Either way, I'm trying to create the equivalent of the sql
SELECT ownership, sum(st_area(the_geom)) AS area FROM resultant GROUP
BY ownership;

Can this be done without dropping to sql?

Cheers,

David

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.


Reply via email to