marklit / osm_split

Feature-specific, named OpenStreetMap (OSM) GeoPackage files
https://tech.marksblogg.com/extracting-osm-features.html
MIT License
21 stars 0 forks source link

Geometry collections of points can't be read by QGIS #6

Open marklit opened 9 months ago

marklit commented 9 months ago

Consider turning these into individual point records. Use a flag so this conversion isn't the default behavior.

$ python ~/osm_split/main.py \
        sweden-latest.osm.pbf \
        --geom-type=other_relations \
        --only-h3=820897fffffffff \
        --polygon-buildings
select * from st_read('other_relations/enforcement.gpkg') limit 1;
┌─────────────┬──────────┬─────────────┬────────────────────────────────────────────────────────────────────────────────────────────────┐
│ enforcement │ maxspeed │    type     │                                              geom                                              │
│   varchar   │ varchar  │   varchar   │                                            geometry                                            │
├─────────────┼──────────┼─────────────┼────────────────────────────────────────────────────────────────────────────────────────────────┤
│ maxspeed    │ 80       │ enforcement │ GEOMETRYCOLLECTION (POINT (16.4761211 57.7223264), POINT (16.4720156 57.7223297), POINT (16.…  │
└─────────────┴──────────┴─────────────┴────────────────────────────────────────────────────────────────────────────────────────────────┘

There are some edge cases like this one where both ends of the bridge are marked with points. Figure out if there is a way to detect these and convert them into sensible geometry.

select * from st_read('other_relations/bridge.gpkg') limit 1;
┌─────────┬──────────────────────────────────────────────────────────────────────────────────┐
│  type   │                                       geom                                       │
│ varchar │                                     geometry                                     │
├─────────┼──────────────────────────────────────────────────────────────────────────────────┤
│ bridge  │ GEOMETRYCOLLECTION (POINT (16.503222 57.7692159), POINT (16.5032595 57.7691777)) │
└─────────┴──────────────────────────────────────────────────────────────────────────────────┘