[][src]Function osm_pbf2json::boundaries

pub fn boundaries(
    file: impl Seek + Read,
    levels: Option<Vec<u8>>
) -> Result<Vec<AdminBoundary>, Box<dyn Error>>

Extract administrative boundaries from OSM

Administrative boundaries are stored in OSM as Relations with the Tag boundary: administrative and a admin_level. The meaning of the individual levels (state, country, etc.) depends on the respective region (read here for details).

The levels can be specified, by default 4, 6, 8, 9, 10 are considered.

Example

use std::fs::File;
use osm_pbf2json::boundaries;

let file = File::open("./tests/data/wilhelmstrasse.pbf").unwrap();
let boundaries = boundaries(file, Some(vec![10])).unwrap();
assert_eq!(boundaries.len(), 2);