Opened 10 years ago
Closed 10 years ago
#24136 closed Bug (fixed)
GeoQueryset.extent() -> TypeError
Reported by: | DemarsM | Owned by: | nobody |
---|---|---|---|
Component: | GIS | Version: | 1.7 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
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()
Change History (2)
comment:1 by , 10 years ago
Easy pickings: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
https://groups.google.com/forum/#!topic/geodjango/VFgGGJfu6HM
This ticket aims to solve the
TypeError: 'NoneType' object has no attribute '__getitem__'
error when the return value of ST_Extent is None.