Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Be tolerant of "invalid" geometries #506

Closed
forman opened this issue Jan 12, 2018 · 0 comments
Closed

Be tolerant of "invalid" geometries #506

forman opened this issue Jan 12, 2018 · 0 comments

Comments

@forman
Copy link
Member

forman commented Jan 12, 2018

Expected behavior

Geometry WKT passed to operation inputs may be valid WKT but produce invalid geometry. That is, the Python shapely geometry object's is_valid property is False. From Shapely User Manual, geometries are invalid in the following cases:

"A valid LinearRing may not cross itself or touch itself at a single point. A valid Polygon may not possess any overlapping exterior or interior rings. A valid MultiPolygon may not collect any overlapping polygons. Operations on invalid features may fail."

However, invalid polygons are quite likely. For example, many Glacier CCI Greenland polygons are invalid w.r.t. the above definition.

If we don't handle these cases with more tolerance, we cannot address #502 without a lot of user frustration.

The solution is straight forward using the Shaply Geometry.buffer method with zero distance:

"Passed a distance of 0, buffer() can be used to 'clean' self-touching or self-crossing polygons such as the classic 'bowtie'.".

Actual behavior

Cate raises an error with "invalid" geometries.

Steps to reproduce the problem

Invoke subset_spatial with invalid polygon WKT, e.g. from Glaciers CCI, greenland.

Specifications

Cate 1.0

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant