duckdb / duckdb/duckdb-spatial
Add ST_SharedPaths
- Dominant language
- C
- Stars
- 708
- Forks
- 96
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 5
Description
ST_SharedPaths returns the linework shared between two (multi)linestrings or polygon boundaries, as a GEOMETRYCOLLECTION holding the same direction and opposite direction shared paths. PostGIS has it and GEOS provides `GEOSSharedPaths_r`, so **it is a near clone of the existing binary geometry to geometry binds such as ST_Difference and ST_Intersection**.
| Function | Returns |
|---|---|
| `ST_SharedPaths(geom1, geom2)` | GEOMETRY, a GEOMETRYCOLLECTION of [forward MULTILINESTRING, backward MULTILINESTRING] |
Implementer tips
- `GEOSSharedPaths_r` always returns a 2 member collection, the first holding edges shared in the same direction, the second the opposite. Empty members are still present, so the shape is fixed.
- Clean wrapper, add a `get_shared_paths` next to `get_difference` and `get_intersection` and register a struct in the same shape.
- PostGIS reference, `ST_SharedPaths` in `lwgeom_geos.c`.
- It is also the building block under the ArcGIS autoComplete editing operation, so useful beyond parity.
Sharing this as research in case it helps whoever picks it up.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.