#11827 closed Uncategorized (fixed)
GeoQuerySet extent() method fails if contains only one object with point geometry
Reported by: | mal | Owned by: | nobody |
---|---|---|---|
Component: | GIS | Version: | 1.1 |
Severity: | Normal | Keywords: | oracle |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I have a point object, with valid, non null geometry.
qs=Point.objects.filter(id=123456)
qs is not empty and contains one object with non null point geometry.
Then, when calling
qs.extent()
i get the following error (as in the end of the stack trace):
36 # the 4-tuple from the coordinates in the polygon. 37 poly = SpatialBackend.Geometry(clob.read()) ---> 38 shell = poly.shell 39 ll, ur = shell[0], shell[2] 40 xmin, ymin = ll AttributeError: 'Point' object has no attribute 'shell'
Change History (7)
comment:1 by , 15 years ago
comment:2 by , 15 years ago
The reason seems to be that when calling "qs.extent" system executes sql like this:
SELECT SDO_UTIL.TO_WKTGEOMETRY(SDO_AGGR_MBR("POINT"."GEOMETRY")) AS geoagg FROM "POINT" WHERE "POINT"."ID" = 123456
so, it's a search by primary key, results in 1 object, and in Oracle (don't know about Postgis) SDO_AGGR_MBR on a collection that contains only one point will result in *point* object, not polygon...
comment:3 by , 15 years ago
Keywords: | oracle added |
---|
Well this is "feature" of Oracle Spatial SDO_AGGR_MBR function. It's describes few "exceptions" as follows (excerpt from Oracle Spatial documentation):
- This function does not return an MBR geometry if a proper MBR cannot be constructed. Specifically:
- If the input geometries are all null, the function returns a null geometry.
- If all data in the input geometries is on a single point, the function returns the point.
- If all data in the input geometries consists of points on a straight line, the function returns a two-point line.
AFAIK at least PostGIS uses st_extent for extent() method which always returns real bounding box.
comment:4 by , 15 years ago
Yes, it's documented Oracle behavior, so it's a bug in the geodjango code.
comment:5 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:6 by , 15 years ago
comment:7 by , 13 years ago
Easy pickings: | unset |
---|---|
Severity: | → Normal |
Type: | → Uncategorized |
UI/UX: | unset |
Apparently it still crashes in this case (Oracle):
"If all data in the input geometries consists of points on a straight line, the function returns a two-point line."
That happens with Oracle Spatial database