spatial icon indicating copy to clipboard operation
spatial copied to clipboard

Repairing invalid geometries

Open missinglink opened this issue 6 years ago • 0 comments

It's fairly common to find geometries with topology errors. A GEOS TopologyException is thrown due to the polygon rings overlapping and various other common errors.

It's possible to leverage GEOS or RTTOPO to attempt to repair these geometries. The challenge will be ensuring that the correct libraries are available and that spatialite is compiled correctly to enable them.

The functionality is exposed in SQL via commands such as SanitizeGeometry() and MakeValid().

I'm not 100% confident that this will be easy to achieve on MacOS, although I've got it working on Linux before, so it might end up being a docker-only thing.

This would be super-useful for some sources (such as OSM) where the internal data-model is not handled by a spatial database which enforces topological validity, or for datasets which are format-shifted and incur errors during that conversion.

related: https://github.com/pelias/spatial/issues/9

missinglink avatar Jul 11 '19 11:07 missinglink