Crates.io | osrmreader |
lib.rs | osrmreader |
version | 0.1.1 |
source | src |
created_at | 2020-09-14 15:03:20.381501 |
updated_at | 2020-09-17 15:50:00.885809 |
description | A reader for *.osrm files that are used by the routing engine OSRM. |
homepage | https://github.com/b-r-u/osrmreader |
repository | https://github.com/b-r-u/osrmreader |
max_upload_size | |
id | 288636 |
size | 47,468 |
A fast reader for the *.osrm
file format.
These files are used by the routing engine OSRM and are usually extracted from
OpenStreetMap data with the tool osrm-extract
. An *.osrm
file encodes the
routing graph as nodes and edges.
Add this to your Cargo.toml
:
[dependencies]
osrmreader = "0.1"
Here's a simple example that prints all nodes and edges:
use osrmreader::{OsrmReader, Entry};
fn main() -> Result<(), std::io::Error> {
let f = std::fs::File::open("tests/test.osrm")?;
let mut reader = OsrmReader::new(f);
for entry in reader.entries()? {
match entry {
Ok(Entry::Nodes(nodes)) => {
// Read nodes
for n in nodes {
println!("{:?}", n?);
}
},
Ok(Entry::Edges(edges)) => {
// Read edges
for e in edges {
println!("{:?}", e?);
}
},
_ => {},
}
}
Ok(())
}
This project is licensed under either of
at your option.