-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Start handling highway=crossing nodes #247
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ use std::collections::HashMap; | |
use abstutil::Tags; | ||
use geom::{HashablePt2D, Pt2D}; | ||
use osm2streets::osm::{NodeID, OsmID, RelationID, WayID}; | ||
use osm2streets::{osm, Direction, RestrictionType}; | ||
use osm2streets::{osm, Crossing, CrossingKind, Direction, RestrictionType}; | ||
|
||
use crate::osm_reader::{Node, Relation, Way}; | ||
use crate::MapConfig; | ||
|
@@ -22,8 +22,7 @@ pub struct OsmExtract { | |
/// Traffic signals and bike stop lines, with an optional direction they apply to | ||
pub traffic_signals: HashMap<HashablePt2D, Option<Direction>>, | ||
pub cycleway_stop_lines: Vec<(HashablePt2D, Option<Direction>)>, | ||
/// Pedestrian crossings with a traffic signal, with unknown direction | ||
pub signalized_crossings: Vec<HashablePt2D>, | ||
pub crossings: HashMap<HashablePt2D, Crossing>, | ||
} | ||
|
||
impl OsmExtract { | ||
|
@@ -36,7 +35,7 @@ impl OsmExtract { | |
|
||
traffic_signals: HashMap::new(), | ||
cycleway_stop_lines: Vec::new(), | ||
signalized_crossings: Vec::new(), | ||
crossings: HashMap::new(), | ||
} | ||
} | ||
|
||
|
@@ -53,10 +52,21 @@ impl OsmExtract { | |
self.cycleway_stop_lines.push((node.pt.to_hashable(), dir)); | ||
} | ||
|
||
// TODO Maybe restricting to traffic_signals is too much. But we definitely don't want to | ||
// use crossing=unmarked to infer stop lines | ||
if node.tags.is("highway", "crossing") && node.tags.is("crossing", "traffic_signals") { | ||
self.signalized_crossings.push(node.pt.to_hashable()); | ||
if node.tags.is("highway", "crossing") || node.tags.is("railway", "crossing") { | ||
let kind = match node.tags.get("crossing").map(|x| x.as_str()) { | ||
Some("traffic_signals") => CrossingKind::Signalized, | ||
Some("uncontrolled" | "marked") => CrossingKind::Marked, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Based on my understanding of https://wiki.openstreetmap.org/wiki/Tag:highway=crossing?uselang=en There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Kind of. The history around crossing classification is quite muddled and quickly devolves into a blame game. Some mappers strongly believe |
||
Some("unmarked") => CrossingKind::Unmarked, | ||
// TODO Look into these cases | ||
_ => CrossingKind::Unmarked, | ||
}; | ||
self.crossings.insert( | ||
node.pt.to_hashable(), | ||
Crossing { | ||
kind, | ||
has_island: node.tags.is("crossing:island", "yes"), | ||
}, | ||
); | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideas for rendering styles welcome, especially for unmarked crossings -- by definition it's quite unclear how to indicate them! Of course these are going to be region-dependent; I'm starting with something simple and we can add configurability later (along with region-specific lane colors, default widths)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably just a void with no road markings would suffice, unless there are regions where it’s normal for a centerline to continue uninterrupted past an unmarked crossing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tough to do today, because osm2streets doesn't know how to continue any road markings into the "intersection polygon" area that gets calculated. That's something @BudgieInWA was working on remedying by detecting "intersections" that're really just merges / forks. I'll keep it in mind as an idea, thank you!