mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-01 02:33:54 +03:00
reduce warnings in map importer
This commit is contained in:
parent
f0ecd914b5
commit
588a20e8d3
@ -16,8 +16,8 @@ pub struct OsmExtract {
|
|||||||
// Traffic signals to the direction they apply (or just true if unspecified)
|
// Traffic signals to the direction they apply (or just true if unspecified)
|
||||||
pub traffic_signals: HashMap<HashablePt2D, bool>,
|
pub traffic_signals: HashMap<HashablePt2D, bool>,
|
||||||
pub osm_node_ids: HashMap<HashablePt2D, NodeID>,
|
pub osm_node_ids: HashMap<HashablePt2D, NodeID>,
|
||||||
// (relation ID, restriction type, from way ID, via node ID, to way ID)
|
// (ID, restriction type, from way ID, via node ID, to way ID)
|
||||||
pub simple_turn_restrictions: Vec<(RelationID, RestrictionType, WayID, NodeID, WayID)>,
|
pub simple_turn_restrictions: Vec<(RestrictionType, WayID, NodeID, WayID)>,
|
||||||
// (relation ID, from way ID, via way ID, to way ID)
|
// (relation ID, from way ID, via way ID, to way ID)
|
||||||
pub complicated_turn_restrictions: Vec<(RelationID, WayID, WayID, WayID)>,
|
pub complicated_turn_restrictions: Vec<(RelationID, WayID, WayID, WayID)>,
|
||||||
// (location, name, amenity type)
|
// (location, name, amenity type)
|
||||||
@ -204,7 +204,7 @@ pub fn extract_osm(map: &mut RawMap, opts: &Options, timer: &mut Timer) -> OsmEx
|
|||||||
if let Some(rt) = RestrictionType::new(restriction) {
|
if let Some(rt) = RestrictionType::new(restriction) {
|
||||||
if let (Some(from), Some(via), Some(to)) = (from_way_id, via_node_id, to_way_id)
|
if let (Some(from), Some(via), Some(to)) = (from_way_id, via_node_id, to_way_id)
|
||||||
{
|
{
|
||||||
out.simple_turn_restrictions.push((id, rt, from, via, to));
|
out.simple_turn_restrictions.push((rt, from, via, to));
|
||||||
} else if let (Some(from), Some(via), Some(to)) =
|
} else if let (Some(from), Some(via), Some(to)) =
|
||||||
(from_way_id, via_way_id, to_way_id)
|
(from_way_id, via_way_id, to_way_id)
|
||||||
{
|
{
|
||||||
@ -619,7 +619,7 @@ fn extract_route(
|
|||||||
"bus" => true,
|
"bus" => true,
|
||||||
"light_rail" => false,
|
"light_rail" => false,
|
||||||
x => {
|
x => {
|
||||||
if x != "road" && x != "bicycle" {
|
if x != "road" && x != "bicycle" && x != "foot" && x != "railway" {
|
||||||
// TODO Handle these at some point
|
// TODO Handle these at some point
|
||||||
println!(
|
println!(
|
||||||
"Skipping route {} of unknown type {}: {}",
|
"Skipping route {} of unknown type {}: {}",
|
||||||
|
@ -93,23 +93,17 @@ pub fn split_up_roads(
|
|||||||
|
|
||||||
// Resolve simple turn restrictions (via a node)
|
// Resolve simple turn restrictions (via a node)
|
||||||
let mut restrictions = Vec::new();
|
let mut restrictions = Vec::new();
|
||||||
for (rel_osm, restriction, from_osm, via_osm, to_osm) in input.simple_turn_restrictions {
|
for (restriction, from_osm, via_osm, to_osm) in input.simple_turn_restrictions {
|
||||||
let roads = map.roads_per_intersection(OriginalIntersection {
|
let roads = map.roads_per_intersection(OriginalIntersection {
|
||||||
osm_node_id: via_osm.0,
|
osm_node_id: via_osm.0,
|
||||||
});
|
});
|
||||||
match (
|
// If some of the roads are missing, they were likely filtered out -- usually service
|
||||||
|
// roads.
|
||||||
|
if let (Some(from), Some(to)) = (
|
||||||
roads.iter().find(|r| r.osm_way_id == from_osm.0),
|
roads.iter().find(|r| r.osm_way_id == from_osm.0),
|
||||||
roads.iter().find(|r| r.osm_way_id == to_osm.0),
|
roads.iter().find(|r| r.osm_way_id == to_osm.0),
|
||||||
) {
|
) {
|
||||||
(Some(from), Some(to)) => {
|
restrictions.push((*from, restriction, *to));
|
||||||
restrictions.push((*from, restriction, *to));
|
|
||||||
}
|
|
||||||
_ => {
|
|
||||||
timer.warn(format!(
|
|
||||||
"Couldn't resolve {:?} from way {} to way {} via node {}: see {}",
|
|
||||||
restriction, from_osm, to_osm, via_osm, rel_osm
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (from, rt, to) in restrictions {
|
for (from, rt, to) in restrictions {
|
||||||
|
@ -201,7 +201,8 @@ impl Map {
|
|||||||
.get(osm::HIGHWAY)
|
.get(osm::HIGHWAY)
|
||||||
.map(|x| x.ends_with("_link"))
|
.map(|x| x.ends_with("_link"))
|
||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
|| road.osm_tags.is("railway", "rail"))
|
|| road.osm_tags.is_any("railway", vec!["rail", "light_rail"])
|
||||||
|
|| road.osm_tags.is("junction", "roundabout"))
|
||||||
{
|
{
|
||||||
timer.warn(format!(
|
timer.warn(format!(
|
||||||
"{} has no name. Tags: {:?}",
|
"{} has no name. Tags: {:?}",
|
||||||
@ -332,19 +333,6 @@ impl Map {
|
|||||||
timer.stop("setup rest of Pathfinder (walking with transit)");
|
timer.stop("setup rest of Pathfinder (walking with transit)");
|
||||||
}
|
}
|
||||||
|
|
||||||
let (_, disconnected) = connectivity::find_scc(&map, PathConstraints::Pedestrian);
|
|
||||||
if !disconnected.is_empty() {
|
|
||||||
timer.warn(format!(
|
|
||||||
"{} sidewalks are disconnected!",
|
|
||||||
disconnected.len()
|
|
||||||
));
|
|
||||||
for l in disconnected {
|
|
||||||
// Best response is to use map_editor to delete them. Hard to do automatically
|
|
||||||
// because maybe there are bus stops nearby -- force myself to look at it manually.
|
|
||||||
timer.warn(format!("- Sidewalk {} is disconnected", l));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
map
|
map
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user