Workaround GTFS snapping problems in Geneva by forcing sidewalks on both sides of oneway roads

This commit is contained in:
Dustin Carlino 2022-03-11 14:35:36 +00:00
parent 606a59cec5
commit fca2e1bc87
2 changed files with 13 additions and 9 deletions

View File

@ -2,7 +2,7 @@ use std::collections::{HashMap, HashSet};
use osm::{NodeID, OsmID, RelationID, WayID}; use osm::{NodeID, OsmID, RelationID, WayID};
use abstio::MapName; use abstio::{CityName, MapName};
use abstutil::{Tags, Timer}; use abstutil::{Tags, Timer};
use geom::{Distance, FindClosest, HashablePt2D, Polygon, Pt2D, Ring}; use geom::{Distance, FindClosest, HashablePt2D, Polygon, Pt2D, Ring};
use kml::{ExtraShape, ExtraShapes}; use kml::{ExtraShape, ExtraShapes};
@ -101,7 +101,7 @@ pub fn extract_osm(
way.tags.insert(osm::OSM_WAY_ID, id.0.to_string()); way.tags.insert(osm::OSM_WAY_ID, id.0.to_string());
if is_road(&mut way.tags, opts) { if is_road(&mut way.tags, opts, &map.name) {
// TODO Hardcoding these overrides. OSM is correct, these don't have // TODO Hardcoding these overrides. OSM is correct, these don't have
// sidewalks; there's a crosswalk mapped. But until we can snap sidewalks properly, do // sidewalks; there's a crosswalk mapped. But until we can snap sidewalks properly, do
// this to prevent the sidewalks from being disconnected. // this to prevent the sidewalks from being disconnected.
@ -355,7 +355,7 @@ pub fn extract_osm(
out out
} }
fn is_road(tags: &mut Tags, opts: &Options) -> bool { fn is_road(tags: &mut Tags, opts: &Options, name: &MapName) -> bool {
if tags.is("area", "yes") { if tags.is("area", "yes") {
return false; return false;
} }
@ -508,6 +508,10 @@ fn is_road(tags: &mut Tags, opts: &Options) -> bool {
{ {
tags.insert(osm::SIDEWALK, "both"); tags.insert(osm::SIDEWALK, "both");
} }
// Hack for Geneva, which maps sidewalks as separate ways
if name.city == CityName::new("ch", "geneva") {
tags.insert(osm::SIDEWALK, "both");
}
} else { } else {
tags.insert(osm::SIDEWALK, "both"); tags.insert(osm::SIDEWALK, "both");
} }

View File

@ -136,9 +136,9 @@
"compressed_size_bytes": 375492248 "compressed_size_bytes": 375492248
}, },
"data/input/ch/geneva/raw_maps/center.bin": { "data/input/ch/geneva/raw_maps/center.bin": {
"checksum": "afff69b7004063ae51cb8e34551d1a00", "checksum": "20c12ba771f4084d1a682687a6bc18f9",
"uncompressed_size_bytes": 12441310, "uncompressed_size_bytes": 12439880,
"compressed_size_bytes": 2737170 "compressed_size_bytes": 2736375
}, },
"data/input/ch/zurich/osm/center.osm": { "data/input/ch/zurich/osm/center.osm": {
"checksum": "c2851c4c0904eb0514299840f567c27d", "checksum": "c2851c4c0904eb0514299840f567c27d",
@ -3071,9 +3071,9 @@
"compressed_size_bytes": 3838389 "compressed_size_bytes": 3838389
}, },
"data/system/ch/geneva/maps/center.bin": { "data/system/ch/geneva/maps/center.bin": {
"checksum": "77b398852dd9a533e94a13fe92a56bff", "checksum": "2299dcfa0f38c52d76be64cdb18e5c16",
"uncompressed_size_bytes": 32256239, "uncompressed_size_bytes": 33200833,
"compressed_size_bytes": 12082511 "compressed_size_bytes": 12482100
}, },
"data/system/ch/zurich/city.bin": { "data/system/ch/zurich/city.bin": {
"checksum": "a209c74a10aa23d23feaf25e1c057efb", "checksum": "a209c74a10aa23d23feaf25e1c057efb",