Code

Opened 12 months ago

Closed 12 months ago

Last modified 12 months 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>]>

Attachments (0)

Change History (3)

comment:1 Changed 12 months ago by claudep

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to worksforme
  • Status changed from new to closed

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 Changed 12 months ago by Claude Paroz <claude@…>

In 6157192b6e15ca94734e56be6c71a4154c6015bd:

Added a test for the envelope() GeoQuerySet method

Refs #20718.

comment:3 Changed 12 months ago by burton449geo@…

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.