[−][src]Function osm_pbf2json::objects
pub fn objects(
file: impl Seek + Read,
groups: &[Group]
) -> Result<Vec<Object>, Box<dyn Error>>
Extract Objects from OSM
Objects (i.e. Nodes, Ways & Relations) will be extracted according to filter options. Some geographic properties (centroid, bounding boxes) are computed for all entities.
Filtering groups
can be applied to select objects according to their tags.
Example
use std::fs::File; use osm_pbf2json::objects; use osm_pbf2json::filter::{Condition, Group}; let file = File::open("./tests/data/alexanderplatz.pbf").unwrap(); let cond_1 = Condition::new("surface", Some("cobblestone")); let cond_2 = Condition::new("highway", None); let group = Group { conditions: vec![cond_1, cond_2] }; let cobblestone_ways = objects(file, &vec![group]).unwrap(); assert_eq!(cobblestone_ways.len(), 4);