don't assume off-side sidewalks on dual_carriageway=yes. don't infer

parking on tiny roads. fixes some geometry in krakow. #230

(unrelated: add a debug layer to show parking blackholes, to work on
bike connections)
(also unrelated: better error message for #256)
This commit is contained in:
Dustin Carlino 2020-07-31 10:07:29 -07:00
parent 8385799844
commit 71b68cc639
6 changed files with 76 additions and 35 deletions

View File

@ -422,7 +422,9 @@ fn is_road(tags: &mut Tags, opts: &Options) -> bool {
tags.insert(osm::SIDEWALK, "none");
} else if tags.is("oneway", "yes") {
tags.insert(osm::SIDEWALK, "right");
if tags.is_any(osm::HIGHWAY, vec!["residential", "living_street"]) {
if tags.is_any(osm::HIGHWAY, vec!["residential", "living_street"])
&& !tags.is("dual_carriageway", "yes")
{
tags.insert(osm::SIDEWALK, "both");
}
} else {

View File

@ -17,10 +17,14 @@ pub fn apply_parking(map: &mut RawMap, opts: &Options, timer: &mut Timer) {
OnstreetParking::SomeAdditionalWhereNoData { pct } => {
let pct = pct as i64;
for (id, r) in map.roads.iter_mut() {
// The 20m minimum is a heuristic. PARKING_SPOT_LENGTH is only 8m, but we haven't
// trimmed roads between intersections yet.
if r.osm_tags.contains_key(osm::INFERRED_PARKING)
&& r.osm_tags
.is_any(osm::HIGHWAY, vec!["residential", "tertiary"])
&& id.osm_way_id % 100 <= pct
&& PolyLine::unchecked_new(r.center_points.clone()).length()
>= Distance::meters(20.0)
{
if r.osm_tags.is("oneway", "yes") {
r.osm_tags.remove(osm::PARKING_BOTH);

View File

@ -8,7 +8,7 @@ data/input/krakow/osm/malopolskie-latest.osm.pbf,9505917bbacc478177e36605e89b6d7
data/input/raw_maps/ballard.bin,6b27e406c965b404a47dc9ef3368dd0f,https://www.dropbox.com/s/ucmgk0cvdj2dx11/ballard.bin.zip?dl=0
data/input/raw_maps/berlin_center.bin,738d2ad43235a9b1149e19a99f87d856,https://www.dropbox.com/s/la6mq4ass8wn6ls/berlin_center.bin.zip?dl=0
data/input/raw_maps/downtown.bin,14add62b40a1c49209b0360431284832,https://www.dropbox.com/s/dr3j53y8aoyatnz/downtown.bin.zip?dl=0
data/input/raw_maps/huge_krakow.bin,0a006a4cf131743654aab28ba38929ee,https://www.dropbox.com/s/6recqu76y7wibsf/huge_krakow.bin.zip?dl=0
data/input/raw_maps/huge_krakow.bin,01717105f2e6d1e40c9a6cdbca8e6ce3,https://www.dropbox.com/s/cyb73b7o45xcf6j/huge_krakow.bin.zip?dl=0
data/input/raw_maps/huge_seattle.bin,23263ab9ffb89a70a38913914191036e,https://www.dropbox.com/s/p34zv29u6lnk1p8/huge_seattle.bin.zip?dl=0
data/input/raw_maps/lakeslice.bin,76fe7173cc5892c932a957db3178ab35,https://www.dropbox.com/s/gx1ljlfo7a2mcse/lakeslice.bin.zip?dl=0
data/input/raw_maps/montlake.bin,36f9647f68623858c655625c59d8c686,https://www.dropbox.com/s/pp6t7c82j1e1gap/montlake.bin.zip?dl=0
@ -16,7 +16,7 @@ data/input/raw_maps/south_seattle.bin,39f2484a46af741b8cc6d7f6e4965c3b,https://w
data/input/raw_maps/udistrict.bin,01a9b18687030019c7d922752b3f1819,https://www.dropbox.com/s/omhrxg9y02oejx2/udistrict.bin.zip?dl=0
data/input/raw_maps/west_seattle.bin,39116eb1a0a07356f736ea5bee552cc9,https://www.dropbox.com/s/k0or6wmygcj5h1l/west_seattle.bin.zip?dl=0
data/input/screenshots/downtown.zip,3e34c19d20f8c6c7def49374bc32dcf1,https://www.dropbox.com/s/qawd35wz62m2acl/downtown.zip.zip?dl=0
data/input/screenshots/huge_krakow.zip,6eccf4a5234828282925b4b7fb0de281,https://www.dropbox.com/s/dbzon7k5ukndtza/huge_krakow.zip.zip?dl=0
data/input/screenshots/huge_krakow.zip,3e7db177f7b40021d5b7c508b934adb9,https://www.dropbox.com/s/dbzon7k5ukndtza/huge_krakow.zip.zip?dl=0
data/input/screenshots/lakeslice.zip,003047ad84f970daa936f2e572c2459b,https://www.dropbox.com/s/z0z96lsn7bunqfy/lakeslice.zip.zip?dl=0
data/input/screenshots/montlake.zip,ef453f3a7d087ce0dc750103f8d55217,https://www.dropbox.com/s/ku5x06hdt0omway/montlake.zip.zip?dl=0
data/input/screenshots/udistrict.zip,dabdbe5bded617635d94072e2963725f,https://www.dropbox.com/s/ecnt1tyza48y9o2/udistrict.zip.zip?dl=0
@ -42,7 +42,7 @@ data/system/cities/seattle.bin,eb9e9621e989247f8cbd7260594cb4b9,https://www.drop
data/system/maps/ballard.bin,85d4cff27f9cb3988e671e32d46c2790,https://www.dropbox.com/s/3ij8i0tczjrz57i/ballard.bin.zip?dl=0
data/system/maps/berlin_center.bin,f6ce50c4fd6605d799a1749947384c47,https://www.dropbox.com/s/yissbkoxox4vpuw/berlin_center.bin.zip?dl=0
data/system/maps/downtown.bin,149647d5a2a830c63713f209185f15fb,https://www.dropbox.com/s/bleeq53zz0lndyb/downtown.bin.zip?dl=0
data/system/maps/huge_krakow.bin,a94ec38c956b3402d9c3f6a90e1c3b6d,https://www.dropbox.com/s/zxulgc673kebe32/huge_krakow.bin.zip?dl=0
data/system/maps/huge_krakow.bin,559d6a6eb02431dd310908547ea8626d,https://www.dropbox.com/s/6ajov91woj2o80v/huge_krakow.bin.zip?dl=0
data/system/maps/huge_seattle.bin,bd6d96c9ddd0d97b50cfb4d139395a42,https://www.dropbox.com/s/5kcynthbwju23aj/huge_seattle.bin.zip?dl=0
data/system/maps/lakeslice.bin,71c042e4d50af4365230f390aed402ee,https://www.dropbox.com/s/2qnmdta35fmtt33/lakeslice.bin.zip?dl=0
data/system/maps/montlake.bin,fa707f16525ec66141549859b193fb8d,https://www.dropbox.com/s/kj5phknx5ghi5fd/montlake.bin.zip?dl=0

View File

@ -304,4 +304,27 @@ impl Static {
Widget::nothing(),
)
}
pub fn parking_blackholes(ctx: &mut EventCtx, app: &App) -> Static {
let mut colorer = ColorDiscrete::new(
app,
vec![
("parking blackhole", Color::RED),
("redirect", Color::GREEN),
],
);
for l in app.primary.map.all_lanes() {
if let Some(redirect) = l.parking_blackhole {
colorer.add_l(l.id, "parking blackhole");
colorer.add_l(redirect, "redirect");
}
}
Static::new(
ctx,
colorer,
"parking blackholes",
"Parking blackholes".to_string(),
Widget::nothing(),
)
}
}

View File

@ -124,6 +124,11 @@ impl PickLayer {
btn("amenities", Key::A),
btn("backpressure", Key::Z),
btn("elevation", Key::V),
if app.opts.dev {
btn("parking blackholes", Key::L)
} else {
Widget::nothing()
},
]);
if app.primary.sim.get_pandemic_model().is_some() {
col.push(btn("pandemic model", Key::Y));
@ -145,19 +150,8 @@ impl State for PickLayer {
"None" => {
app.layer = None;
}
"parking occupancy" => {
app.layer = Some(Box::new(parking::Occupancy::new(
ctx, app, true, true, true, false,
)));
}
"delay" => {
app.layer = Some(Box::new(traffic::Delay::new(ctx, app, false)));
}
"traffic jams" => {
app.layer = Some(Box::new(traffic::TrafficJams::new(ctx, app)));
}
"throughput" => {
app.layer = Some(Box::new(traffic::Throughput::new(ctx, app, false)));
"amenities" => {
app.layer = Some(Box::new(map::Static::amenities(ctx, app)));
}
"backpressure" => {
app.layer = Some(Box::new(traffic::Backpressure::new(ctx, app)));
@ -165,22 +159,35 @@ impl State for PickLayer {
"bike network" => {
app.layer = Some(Box::new(map::BikeNetwork::new(ctx, app)));
}
"transit network" => {
app.layer = Some(Box::new(transit::TransitNetwork::new(
ctx, app, false, true, true,
)));
"delay" => {
app.layer = Some(Box::new(traffic::Delay::new(ctx, app, false)));
}
"elevation" => {
app.layer = Some(Box::new(elevation::Elevation::new(ctx, app)));
}
"no sidewalks" => {
app.layer = Some(Box::new(map::Static::no_sidewalks(ctx, app)));
}
"map edits" => {
app.layer = Some(Box::new(map::Static::edits(ctx, app)));
}
"amenities" => {
app.layer = Some(Box::new(map::Static::amenities(ctx, app)));
"no sidewalks" => {
app.layer = Some(Box::new(map::Static::no_sidewalks(ctx, app)));
}
"pandemic model" => {
app.layer = Some(Box::new(pandemic::Pandemic::new(
ctx,
app,
pandemic::Options {
heatmap: Some(HeatmapOptions::new()),
state: pandemic::SEIR::Infected,
},
)));
}
"parking blackholes" => {
app.layer = Some(Box::new(map::Static::parking_blackholes(ctx, app)));
}
"parking occupancy" => {
app.layer = Some(Box::new(parking::Occupancy::new(
ctx, app, true, true, true, false,
)));
}
"population map" => {
app.layer = Some(Box::new(population::PopulationMap::new(
@ -191,14 +198,15 @@ impl State for PickLayer {
},
)));
}
"pandemic model" => {
app.layer = Some(Box::new(pandemic::Pandemic::new(
ctx,
app,
pandemic::Options {
heatmap: Some(HeatmapOptions::new()),
state: pandemic::SEIR::Infected,
},
"throughput" => {
app.layer = Some(Box::new(traffic::Throughput::new(ctx, app, false)));
}
"traffic jams" => {
app.layer = Some(Box::new(traffic::TrafficJams::new(ctx, app)));
}
"transit network" => {
app.layer = Some(Box::new(transit::TransitNetwork::new(
ctx, app, false, true, true,
)));
}
_ => unreachable!(),

View File

@ -127,7 +127,11 @@ fn generalized_trim_back(
};
if use_pl1 == use_pl2 {
panic!("{} and {} wind up with the same polyline", r1, r2);
panic!(
"{} and {} have overlapping segments. You likely need to fix OSM and make the \
two ways meet at exactly one node.",
r1, r2
);
}
if let Some((hit, angle)) = use_pl1.intersection(&use_pl2) {