[][src]Function osm_pbf2json::streets

pub fn streets(
    file: impl Seek + Read,
    name: Option<&str>,
    boundary: Option<u8>
) -> Result<Vec<Street>, Box<dyn Error>>

Extract a list of streets from a set of OSM Objects

Streets are represented in OSM as a collection of smaller Way segments. To cluster those into distinct street entities name Tag and the geographical distance are considered.

A name can be given to retrieve only streets with a matching name.

Sometimes continuous streets cross boundaries. Streets are split along administrative boundary borders, when specifying a boundary option.

Example

use std::fs::File;
use osm_pbf2json::streets;

let file = File::open("./tests/data/wilhelmstrasse.pbf").unwrap();
let name = "Wilhelmstraße";
let streets = streets(file, Some(name), Some(10)).unwrap();
assert_eq!(streets.len(), 2);