Opened 8 years ago

Closed 8 years ago

#6417 closed task (fixed)

Layer algebra methods should be allowed to fail if GEOS methods fail.

Reported by: Ari Jolma Owned by: Ari Jolma
Priority: normal Milestone: 2.1.0
Component: default Version: unspecified
Severity: normal Keywords:
Cc:

Description

GEOS methods may fail due to topology problems at least. Currently the methods may crash due in those cases or continue (the error is probably emitted). Should SKIP_FAILURES be extended to this case or should we unconditionally fail?

Change History (5)

comment:1 by Ari Jolma, 8 years ago

Owner: changed from warmerdam to Ari Jolma

comment:2 by Even Rouault, 8 years ago

If SKIP_FAILURES is defined, it makes sense to skip failures due to GEOS errors. And in any case, crashes should be avoided.

comment:3 by Ari Jolma, 8 years ago

Hm. Additional complication: GEOS methods, which return booleans (e.g. intersects()). Do they throw topology exceptions and if yes can we catch those?

comment:4 by Even Rouault, 8 years ago

intersects() doesn't seem to always reports topology exceptions as show below, but anyway you can check with CPLGetLastErrorType() afterwards (and by clearing with CPLErrorReset() before)

>>> from osgeo import gdal, ogr
>>> g = ogr.CreateGeometryFromWkt('POLYGON((0 0,1 1,0 1,1 0,0 0))')
>>> g.Intersects(g)
True
>>> g = ogr.CreateGeometryFromWkt('POLYGON((0 0))')
>>> g.Intersects(g)
ERROR 1: IllegalArgumentException: point array must contain 0 or >1 elements

ERROR 1: IllegalArgumentException: point array must contain 0 or >1 elements

False
>>> gdal.GetLastErrorType()
3

comment:5 by Ari Jolma, 8 years ago

Resolution: fixed
Status: newclosed

Fixed in r33751. More extensive tests could be useful.

Note: See TracTickets for help on using tickets.