A command line tool to preprocess OpenStreetMap data for routing purposes. The tool reads an OpenStreetMap pbf file, filters data that is not relevant for routing (e.g. buildings) and produces a much smaller pbf file. At the same time, the tool enriches the data with information about the country the data is in and optionally with elevation data.
The output pbf file can be used e.g. for openrouteservice graph building.
Run all tests:
cargo testIntegration tests:
cargo test --test integration_testcargo clean
cargo run -- <options>To get help about the command line options, run:
cargo run -- -hcargo clean
cargo buildOr a optimized, faster version (build is slower):
cargo clean
cargo build --releaseThe executable binaries created by cargo build or cargo build --release are located in the target/debug or target/release directory respectively.
You can run the executable with the same options as described above for running locally:
./target/debug/osm-transform <options>
./target/release/osm-transform <options>Run docker build and tag the image with e.g. local/osm-transform:latest:
docker rmi local/osm-transform:latest # if you have an old image
docker build -t local/osm-transform:latest .If you don't want to build a docker image yourself, you can use the prebuilt image from docker hub: heigit/osm-transform:latest.
In the other examples in this README, add replace local/osm-transform:latest with heigit/osm-transform:latest.
When running the docker image, you can add all command line options for the rust application behind the docker image name. E.g. you can get help by running the following command:
docker run --rm local/osm-transform:latest -hIn all other use cases than getting help, you want to process an input file and potentially enrich the data with
information from other files. Therefore you need to mount the directories containing the input files to the docker.
The following command mounts the directories ~/data/osm, ~/data/countries and ~/data/elevation to the docker
directories /app/osm, /app/countries and /app/elevation respectively.
You can mount whichever directories you want, but you need to adjust the paths in the command according to the
paths in the container:
docker run --rm \
-v ~/data/osm:/app/osm \
-v ~/data/countries:/app/countries \
-v ~/data/elevation:/app/elevation \
-v .:/app/out \
local/osm-transform:latest \
-i /app/osm/heidelberg.test.pbf \
-o /app/out/heidelberg.ot.pbf \
-c /app/countries/world_borders_idx_0_40 \
-e '/app/elevation/*/*.tif' \
-vvv- performance and memory usage improvements
- enable custom filter options
- support for more custom enrichment source files, e.g.:
- other csv area with other information than countries, e.g. time zones
- other geotiff files for raster based enrichment
- make it possible to only build area indexes without processing a pbf file