Skip to content

Conversation

@missinglink
Copy link
Member

This PR adds a new import flag which runs either MakeValid or GeosMakeValid to repair broken/invalid geometries.

The feature can be enabled using a flag on the command-line when importing data such as:

spatial import --tweak_module_geometry_repair=2 source

Supported values are 0=none, 1=MakeValid, 2=GeosMakeValid

I would like to experiment a bit more with this feature before considering enabling it by default, for very broken geometries it will potentially do things like convert polygons to linestrings, which may or may not be desirable.

ref: https://www.gaia-gis.it/gaia-sins/spatialite-sql-5.1.0.html#MakeValid

@missinglink
Copy link
Member Author

These operations are quite noisy since RTTOPO outputs warnings for broken geometries.

There are in fact a lot of errors in the WOF data, mostly winding errors and intersection errors such as these:

GEOS warning: Ring Self-intersection at or near point 5.0343859999999996 52.344605999999999
GEOS warning: Ring Self-intersection at or near point 5.0540279999999997 52.541148
GEOS warning: Ring Self-intersection at or near point 5.0240309999999999 52.600085
GEOS warning: Ring Self-intersection at or near point 3.7195610000000001 51.527552999999997
GEOS warning: Self-intersection at or near point 4.4982452727272646 51.906334999999999
GEOS warning: Self-intersection at or near point -75.491668000000004 -14.928178000000001

@missinglink missinglink merged commit 1d9d7eb into master Nov 12, 2025
6 checks passed
@missinglink missinglink deleted the geometry-repair branch November 12, 2025 14:30
@missinglink
Copy link
Member Author

Running repair operation on WOF data yields some interesting cases such as this feature which is converted MULTIPOLYGON->GEOMETRYCOLLECTION.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants