This project is the result of playing around with libosmium and polygon inclusion.
It allows to extract all nodes, ways and relations in an OSM data file
with regard to inclusion in a set of (multi-)polygons defined in a
simple geojson
file.
- Nodes included in the polygons are kept.
- Ways containing at least a node in the polygons are kept and stay complete (even their nodes that are not in the polygons are included).
- Relations that have at least one node or a way member in the polygons are included with all their members (not reference-complete).
Using this geojson file.
Using this geojson file.
Using this geojson file.
Make sure boost
is installed on your system, clone the repo and
build from the src
folder.
git clone https://github.com/jcoupey/osmium-polygon.git
cd osmium-polygon/src/
make
cd ..
Use -p
to describe which geojson file contains your (multi-)polygons
and run on any OSM data file.
./osmium-polygon -p files/berlin_heart.geojson berlin-latest.osm.pbf
In the src
folder, build and run using:
make test
cd ../
./osmium-polygon-tests