diff --git a/Cargo.lock b/Cargo.lock index 340b1663..c60b2c94 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1038,7 +1038,7 @@ dependencies = [ [[package]] name = "osm-reader" version = "0.1.0" -source = "git+https://github.com/a-b-street/osm-reader#ae39050497fff871bba37559ee67918781dc6838" +source = "git+https://github.com/a-b-street/osm-reader#e857c5e899219b4430e612595ee5cdfe6b59054d" dependencies = [ "anyhow", "osmpbf", diff --git a/osm2streets-js/src/lib.rs b/osm2streets-js/src/lib.rs index 058f362a..036b29fe 100644 --- a/osm2streets-js/src/lib.rs +++ b/osm2streets-js/src/lib.rs @@ -234,10 +234,9 @@ impl JsStreetNetwork { pub fn way_to_xml(&self, id: i64) -> String { let way = &self.ways[&osm::WayID(id)]; let mut out = format!(r#"\n"); for node in &way.nodes { out.push_str(&format!(r#" "#, node.0)); diff --git a/streets_reader/src/osm_reader/mod.rs b/streets_reader/src/osm_reader/mod.rs index f9fa1ebb..7990bcbf 100644 --- a/streets_reader/src/osm_reader/mod.rs +++ b/streets_reader/src/osm_reader/mod.rs @@ -24,6 +24,7 @@ pub struct Document { pub struct Node { pub pt: Pt2D, pub tags: Tags, + pub version: Option, } #[derive(Clone)] @@ -32,10 +33,12 @@ pub struct Way { pub nodes: Vec, pub pts: Vec, pub tags: Tags, + pub version: Option, } pub struct Relation { pub tags: Tags, /// Role, member pub members: Vec<(String, OsmID)>, + pub version: Option, } diff --git a/streets_reader/src/osm_reader/reader.rs b/streets_reader/src/osm_reader/reader.rs index 52616021..6ec6a676 100644 --- a/streets_reader/src/osm_reader/reader.rs +++ b/streets_reader/src/osm_reader/reader.rs @@ -49,7 +49,13 @@ impl Document { ])); } } - Element::Node { id, lon, lat, tags } => { + Element::Node { + id, + lon, + lat, + tags, + version, + } => { if doc.gps_bounds.is_none() { warn!( "No clipping polygon provided and the .osm is missing a element, \ @@ -68,10 +74,16 @@ impl Document { Node { pt, tags: make_tags(tags), + version, }, ); } - Element::Way { id, node_ids, tags } => { + Element::Way { + id, + node_ids, + tags, + version, + } => { if doc.ways.contains_key(&id) { panic!("Duplicate {id}, your .osm is corrupt"); } @@ -92,6 +104,7 @@ impl Document { nodes, pts, tags: make_tags(tags), + version, }, ); } @@ -100,6 +113,7 @@ impl Document { id, tags, mut members, + version, } => { if doc.relations.contains_key(&id) { panic!("Duplicate {id}, your .osm is corrupt"); @@ -116,6 +130,7 @@ impl Document { Relation { tags: make_tags(tags), members, + version, }, ); }