pelias / pelias/spatial

Repairing invalid geometries

Open
#10 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
JavaScript
Stars
32
Forks
8
Avg merge
13m
Merged PRs (30d)
1

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start by inspecting the build and dependency configuration for spatialite, GEOS, and RTTOPO, then trace how SQL functions are exposed. Define support across Linux and macOS, and verify that invalid geometries can be repaired through the proposed SanitizeGeometry() or MakeValid() commands.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, sql
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.