diff --git a/convert_osm/src/osm_reader.rs b/convert_osm/src/osm_reader.rs index 4154df9602..185a63fc08 100644 --- a/convert_osm/src/osm_reader.rs +++ b/convert_osm/src/osm_reader.rs @@ -417,9 +417,11 @@ fn tags_to_map(raw_tags: &[osm_xml::Tag]) -> Tags { } fn is_road(tags: &mut Tags) -> bool { - if tags.is("railway", "light_rail") { + if tags.is_any("railway", vec!["light_rail", "rail"]) { return true; } + // TODO Because trams overlap with roads, they're harder: + // https://github.com/dabreegster/abstreet/issues/141 if tags.is("railway", "tram") { return false; } diff --git a/map_model/src/make/initial/lane_specs.rs b/map_model/src/make/initial/lane_specs.rs index 2c93a897e8..bb4b4b0166 100644 --- a/map_model/src/make/initial/lane_specs.rs +++ b/map_model/src/make/initial/lane_specs.rs @@ -18,7 +18,7 @@ pub fn get_lane_types(osm_tags: &BTreeMap) -> (Vec, Ve } // Easy special cases first. - if tags.is("railway", "light_rail") { + if tags.is_any("railway", vec!["light_rail", "rail"]) { return (vec![LaneType::LightRail], Vec::new()); } if tags.is(osm::HIGHWAY, "footway") { diff --git a/map_model/src/raw.rs b/map_model/src/raw.rs index 3f16001560..c6d2d3b293 100644 --- a/map_model/src/raw.rs +++ b/map_model/src/raw.rs @@ -344,8 +344,13 @@ impl RawRoad { self.osm_tags.get(osm::SYNTHETIC) == Some(&"true".to_string()) } + // TODO For the moment, treating all rail things as light rail pub fn is_light_rail(&self) -> bool { - self.osm_tags.get("railway") == Some(&"light_rail".to_string()) + if let Some(v) = self.osm_tags.get("railway") { + vec!["light_rail", "rail"].contains(&v.as_ref()) + } else { + false + } } pub fn is_footway(&self) -> bool {