#24136: GeoQueryset.extent() -> TypeError
----------------------------+--------------------
Reporter: DemarsM | Owner: nobody
Type: Bug | Status: new
Component: GIS | Version: 1.7
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
----------------------------+--------------------
Im trying to get the extent of a GeoQueryset as explained in the doc:
{{{
class Feature(models.Model):
geom_point = models.PointField(srid=3857, blank=True, null=True)
geom_multipoint = models.MultiPointField(srid=3857, blank=True,
null=True)
geom_multilinestring = models.MultiLineStringField(srid=3857,
blank=True, null=True)
geom_multipolygon = models.MultiPolygonField(srid=3857, blank=True,
null=True)
geom_geometrycollection = models.GeometryCollectionField(srid=3857,
blank=True, null=True)
}}}
for a specific feature, only one of the geometry field is not empty
{{{
featuresExtent = Feature.objects.all().extent()
}}}
{{{
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "C:\Python27\lib\site-
packages\django\contrib\gis\db\models\query.py", li
ne 119, in extent
return self._spatial_aggregate(aggregates.Extent, **kwargs)
File "C:\Python27\lib\site-
packages\django\contrib\gis\db\models\query.py", li
ne 505, in _spatial_aggregate
return self.aggregate(geoagg=aggregate(agg_col,
**agg_kwargs))['geoagg']
File "C:\Python27\lib\site-packages\django\db\models\query.py", line
325, in a
ggregate
return query.get_aggregation(using=self.db, force_subq=force_subq)
File "C:\Python27\lib\site-
packages\django\contrib\gis\db\models\sql\query.py"
, line 76, in get_aggregation
return super(GeoQuery, self).get_aggregation(using, force_subq)
File "C:\Python27\lib\site-packages\django\db\models\sql\query.py", line
397,
in get_aggregation
in zip(query.aggregate_select.items(), result)
File "C:\Python27\lib\site-packages\django\db\models\sql\query.py", line
396,
in <genexpr>
for (alias, aggregate), val
File "C:\Python27\lib\site-
packages\django\contrib\gis\db\models\sql\query.py"
, line 88, in resolve_aggregate
return connection.ops.convert_extent(value)
File "C:\Python27\lib\site-
packages\django\contrib\gis\db\backends\postgis\ope
rations.py", line 285, in convert_extent
ll, ur = box[4:-1].split(',')
TypeError: 'NoneType' object has no attribute '__getitem__'
}}}
same error if I do:
{{{
Feature.objects.filter(pk=1).extent()
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24136>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/050.258b13d40d6ea7a366e952073216c73f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.