Running osmium
CLI job with pyosmium
#224
-
Hello! I am wondering if someone could give me some directions how to replicate this osmium export -o data/osm/geojson/SYC-latest-linestring.geojson -c config.json -O data/osm/pbf/SYC.osm.pbf --geometry-types=linestring I found a way to filter the tags, but not sure how to also pass the geometry types and multiple tags at the same time. Thanks in advance for any feedback! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
If you want to work with geometries, then you should use shapely. The documentation has a short section how to get the geometry inside the handler. Once you have a Shapely geometry, you can convert it to geojson, add tags as properties and write everything out again. |
Beta Was this translation helpful? Give feedback.
-
Just for the fun of it, I've added an example for printing geojson from geometries: https://github.com/osmcode/pyosmium/blob/master/examples/convert_to_geojson.py Turns out you don't even need shapely. If you are only interested in LineStrings, then you only need the |
Beta Was this translation helpful? Give feedback.
Just for the fun of it, I've added an example for printing geojson from geometries: https://github.com/osmcode/pyosmium/blob/master/examples/convert_to_geojson.py Turns out you don't even need shapely. If you are only interested in LineStrings, then you only need the
way()
callback.