diff --git a/docs/TODO_game.md b/docs/TODO_game.md index 035b07135d..dd0926697d 100644 --- a/docs/TODO_game.md +++ b/docs/TODO_game.md @@ -5,6 +5,7 @@ - need intersection merging before this is understandable - close interior neighborhoods to most cars (except for src/dst), see how traffic restricted to arterials would work - puzzle: with only X miles of retained road, where would you leave them? what roads would go away? + - parking garages on the edges of neighborhoods? - create a bike network with minimal hills, dedicated roads, minimal crossings - easter eggs diff --git a/map_model/src/make/half_map.rs b/map_model/src/make/half_map.rs index 0e5421e17b..39309f9af5 100644 --- a/map_model/src/make/half_map.rs +++ b/map_model/src/make/half_map.rs @@ -126,6 +126,12 @@ pub fn make_half_map( bus_stops: Vec::new(), }); } + if road.get_name() == "???" { + timer.warn(format!( + "{} has no name. Tags: {:?}", + road.id, road.osm_tags + )); + } half_map.roads.push(road); } diff --git a/map_model/src/road.rs b/map_model/src/road.rs index 11c68fca65..0ce74ec541 100644 --- a/map_model/src/road.rs +++ b/map_model/src/road.rs @@ -333,9 +333,29 @@ impl Road { } pub fn get_name(&self) -> String { - self.osm_tags - .get("name") - .unwrap_or(&"???".to_string()) - .to_string() + if let Some(name) = self.osm_tags.get("name") { + return name.to_string(); + } + if let Some(name) = self.osm_tags.get("ref") { + return name.to_string(); + } + if self + .osm_tags + .get("highway") + .map(|hwy| hwy.ends_with("_link")) + .unwrap_or(false) + { + if let Some(name) = self.osm_tags.get("destination:street") { + return format!("Exit for {}", name); + } + if let Some(name) = self.osm_tags.get("destination:ref") { + return format!("Exit for {}", name); + } + if let Some(name) = self.osm_tags.get("destination") { + return format!("Exit for {}", name); + } + // Sometimes 'directions' is filled out, but incorrectly... + } + "???".to_string() } }