Changes between Version 1 and Version 2 of Ticket #26112


Ignore:
Timestamp:
Jan 21, 2016, 5:55:35 AM (9 years ago)
Author:
Daniel Wiesmann
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #26112 – Description

    v1 v2  
    1 There is an error when trying to compute a regular aggregate value from  a GIS aggregate output. To take an example from the GIS geoapp tests, the following query fails.
     1There is an error when trying to compute a regular aggregate value from  a GIS Area aggregate output. To take an example from the GIS geoapp tests, the following query fails.
    22
    33{{{
    44from django.db.models import Sum
    5 from django.contrib.gis.db.models.functions import Area, Intersection
     5from django.contrib.gis.db.models.functions import Area
    66
    7 Country.objects.annotate(intersum=Sum(Area(Intersection('mpoly', geom))))
     7Country.objects.annotate(areasum=Sum(Area('mpoly')))
    88}}}
    99
     
    1212https://github.com/django/django/blob/master/django/contrib/gis/db/models/fields.py#L259
    1313
    14 The problem seems to be that the `Sum` function returns a float, but the field is expecting a value that can be converted to a Geometry.
     14The problem seems to be that the `Area` function returns a float, but the field is expecting a value that can be converted to a Geometry.
    1515
    16 I'll open a pull request with a regression test and a proposed solution, basically checking if the value is a float or int.
     16I'll open a pull request with a regression test and a proposed solution.
Back to Top