A Rust-based tool for analyzing OpenStreetMap data to categorize bicycle infrastructure and surface types from OSM PBF files.
This tool processes OpenStreetMap .osm.pbf files and analyzes highway features to:
- Classify bicycle infrastructure (lanes, paths, mixed ways, etc.)
- Categorize surface types
- Optionally export geometries as WKT linestrings
The tool uses parallel processing for efficient handling of large OSM datasets.
- Rust toolchain (rustc and cargo)
- Install from https://rustup.rs/
Build the project in release mode for optimal performance:
cargo build --releaseThe compiled binary will be located at target/release/osmcategorizer_rust.exe (Windows) or target/release/osmcategorizer_rust (Linux/macOS).
osmcategorizer_rust -i <input.osm.pbf> -o <output.csv>To include WKT linestring geometries in the output:
osmcategorizer_rust -i <input.osm.pbf> -o <output.csv> -g-i, --input-file <PATH>- Path to the input OSM PBF file (required)-o, --output-file <PATH>- Path to the output CSV file (required)-g, --export-line-strings- Export way geometries as WKT linestrings (optional)
# Analyze Leipzig bicycle infrastructure
cargo run --release -- -i data/Leipzig_osm.osm.pbf -o leipzig_assessed.csv
# Analyze with geometries
cargo run --release -- -i data/sachsen-latest.osm.pbf -o sachsen_assessed.csv -gThe tool generates a CSV file with the following columns:
osm_id- OpenStreetMap way IDbicycle_infrastructure- Categorized bicycle infrastructure typesurface_cat- Surface category (numerical)
osm_id- OpenStreetMap way IDbicycle_infrastructure- Categorized bicycle infrastructure typesurface_cat- Surface category (numerical)WKT- Way geometry as WKT LINESTRING
cargo testThe tool uses parallel processing to efficiently handle large OSM datasets. Processing time depends on file size and whether geometry export is enabled.