Sharding invalid geometries
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 32
- Forks
- 8
- Avg merge
- 13m
- Merged PRs (30d)
- 1
Description
The 'shard' process halves a geometry (alternating horizontally & vertically) until each shard complexity is below a fixed threshold.
This ensures that the PIP performance is fast and linear.
This process is tested and works well, however, I have seen some geometries which fail to split due to topology errors.
It's pretty rare, it doesn't affect any WOF geometries and less than 1 in 10,000 OSM geometries.
I'll open up a separate issue related to repairing invalid geometries, but this issue is simply to handle the case where sharding fails due to a topology error.
In the case where a shard fails to half, we should:
- discard both of the two child halves (the ones created at
level+1) - do not delete the parent shard (the one at
level)
I attempted to fix this in the past but for some reason IsValid() is returning 1 despite the shard geom being invalid.
It might be that spatialite@5 is better at handling this because it uses LIBRTTOPO instead of GEOS.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the shard process and the handling around IsValid(), then compare how spatialite@5, GEOS, and LIBRTTOPO report topology errors. Done means that when a shard fails to split, both level+1 child halves are discarded while the level parent shard remains.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, sqlite
- Domain
- database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100