﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
26112	Aggregate Sum of GIS Aggregates fails	Daniel Wiesmann	Daniel Wiesmann	"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.

{{{
from django.db.models import Sum
from django.contrib.gis.db.models.functions import Area

Country.objects.annotate(areasum=Sum(Area('mpoly')))
}}}

I tracked this down to the `from_db_value` function in the GeometryField class here:

https://github.com/django/django/blob/master/django/contrib/gis/db/models/fields.py#L259

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.

I'll open a pull request with a regression test and a proposed solution."	Bug	closed	GIS	dev	Normal	fixed	aggregates		Accepted	1	0	0	0	0	0
