Changes between Version 1 and Version 2 of Ticket #26112
- Timestamp:
- Jan 21, 2016, 5:55:35 AM (9 years ago)
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.1 There 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. 2 2 3 3 {{{ 4 4 from django.db.models import Sum 5 from django.contrib.gis.db.models.functions import Area , Intersection5 from django.contrib.gis.db.models.functions import Area 6 6 7 Country.objects.annotate( intersum=Sum(Area(Intersection('mpoly', geom))))7 Country.objects.annotate(areasum=Sum(Area('mpoly'))) 8 8 }}} 9 9 … … 12 12 https://github.com/django/django/blob/master/django/contrib/gis/db/models/fields.py#L259 13 13 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.14 The 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. 15 15 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.16 I'll open a pull request with a regression test and a proposed solution.