osmpbfreader-rs Build status

Read OpenStreetMap PBF files with rust in an easy and effective way. The main inspiration of this library is libosmpbfreader.

Documentation

Find it on Docs.rs

Using this lib

This crate works with Cargo and is on crates.io. The package is regularly updated. Add it to your Cargo.toml like so:

toml [dependencies] osmpbfreader = "0.6"

For complete example, you can see the examples.

You can find OSM PBF files at Geofabrik's free download server.

Performances

Using the count example compiled in release mode: ``` $ cat /proc/cpuinfo | grep name | head -1 model name : Intel(R) Core(TM) i5-4200U CPU @ 1.60GHz $ rustc --version rustc 1.14.0 (e8a012324 2016-12-16) $ ls -sh ile-de-france-latest.osm.pbf 232M ile-de-france-latest.osm.pbf $ time ./target/release/examples/count ile-de-france-latest.osm.pbf adminlevel 8 counting objects with tags["adminlevel"] = "8"... 4 nodes, mean coord: 48.795432325, 2.3825434. 3941 ways, mean |nodes|: 37.275310834813496 1423 relations, mean |references|: 8.586788475052705

real 0m19.923s user 0m19.700s sys 0m0.208s ```

License

This work is free. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See the COPYING file for more details.

Note that src/fileformat.proto and src/osmformat.proto come from OSM-binary under the LGPLv3.

TODO

TODO list: - document until #![deny(missing_docs)] can be added; - read pbf header to check that we support all needed features; - do something better than borrowed_iter.