Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#20718 closed Bug (worksforme)

Geoqueryset method do not return a value

Reported by: burton449geo@… 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 Claude Paroz, 11 years ago

Resolution: worksforme
Status: newclosed

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.

comment:2 by Claude Paroz <claude@…>, 11 years ago

In 6157192b6e15ca94734e56be6c71a4154c6015bd:

Added a test for the envelope() GeoQuerySet method

Refs #20718.

comment:3 by burton449geo@…, 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

Note: See TracTickets for help on using tickets.
Back to Top