#20718 closed Bug (worksforme)
Geoqueryset method do not return a value
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | GIS | Version: | 1.5-rc-1 |
Severity: | Normal | Keywords: | geodjango |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Im trying to get values from geoqueryset methods but they do not return values. I use spatialite 4.0.0 as db.
Example:
bounds = Feature.objects.filter(id=feature.id).envelope()
print bounds.perimeter
<bound method GeoQuerySet.perimeter of [<Feature: 43>]>
other example:
bounds = Feature.objects.filter(id=feature.id).envelope()
print bounds.geojson(bbox=True)
[<Feature: 43>]
other example:
bounds = Feature.objects.filter(id=feature.id).envelope()
print bounds.geojson(bbox=True)
<bound method GeoQuerySet.area of [<Feature: 38>]>
Change History (3)
comment:1 by , 11 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
comment:3 by , 11 years ago
Ok, I understand that the methods do not return values but something seems to be wrong anyway
bounds = Feature.objects.filter(id=feature.id).geojson()
print(bounds.geojson)
<bound method GeoQuerySet.geojson of [<Feature: 17>]>
With Spatialite 4.0.0 the area() method just not work:
bounds = Feature.objects.filter(id=feature.id).area()
print(bounds.area)
no such table: spatial_ref_sys
But the table spatial_ref_sys do exists in the db
As documented here: https://docs.djangoproject.com/en/dev/ref/contrib/gis/geoquerysets/#envelope, envelope is adding an
envelope
property for each element in the queryset.So I'm not sure exactly what you expected. But
envelope()
is not meant to return a special result, it only adds an attribute on result objects.Seeing that
envelope
is currently untested, I'll commit a test soon.