clarisma / geodesk

Fast and storage-efficient spatial database engine for OpenStreetMap data
https://docs.geodesk.com/java
Apache License 2.0
137 stars 4 forks source link

Flatten geometries of super-relations #21

Open clarisma opened 1 year ago

clarisma commented 1 year ago

Super-relations like relation/1268955 don't have geometries in the traditional sense; they are used to express concepts. Right now, toGeometry() created a recursive GEOMETRYCOLLECTION:

GEOMETRYCOLLECTION (GEOMETRYCOLLECTION (POINT (114501405 762733414), POINT (114501740 762732702)), GEOMETRYCOLLECTION (POINT (114511323 762746639), POINT (114510645 762747135)))

This is legal, but not very useful, and causes issues with JTS like #19. Better approach would be to flatten any points, lines and polygons into a single GEOMETRYCOLLECTION.

clarisma commented 1 year ago

Should the polygons of multipolygons be added individually? (Right now, entire MP is added to collection)

clarisma commented 1 year ago

Related: #46

clarisma commented 1 year ago

A collection of multi-polygons is different from a multi-polygon composed of all individual polygons. In the former, separate (multi-)polygons may overlap with other (multi-)polygons or have collinear edges; in the latter, this would make the single multi-polygon invalid.