some fixes to get Perth to import, part of #27

- filter out indoor corridors
- plumb through a flag for driving on the right/left. don't use it yet.
This commit is contained in:
Dustin Carlino 2020-03-16 15:20:35 -07:00
parent 2ae6992a3e
commit 1cce49648b
14 changed files with 55 additions and 27 deletions

View File

@ -66,6 +66,14 @@ impl CmdArgs {
} }
} }
pub fn true_false(&mut self, key: &str) -> bool {
match self.required(key).as_ref() {
"true" => true,
"false" => false,
x => panic!("{}={} is invalid; must be true or false", key, x),
}
}
pub fn enabled(&mut self, key: &str) -> bool { pub fn enabled(&mut self, key: &str) -> bool {
if self.bits.remove(key) { if self.bits.remove(key) {
self.used.insert(key.to_string()); self.used.insert(key.to_string());

View File

@ -22,6 +22,7 @@ pub struct Flags {
pub neighborhoods: Option<String>, pub neighborhoods: Option<String>,
pub elevation: Option<String>, pub elevation: Option<String>,
pub clip: Option<String>, pub clip: Option<String>,
pub drive_on_right: bool,
pub output: String, pub output: String,
} }
@ -31,6 +32,7 @@ pub fn convert(flags: &Flags, timer: &mut abstutil::Timer) -> RawMap {
timer, timer,
); );
clip::clip_map(&mut map, timer); clip::clip_map(&mut map, timer);
map.drive_on_right = flags.drive_on_right;
// Need to do a first pass of removing cul-de-sacs here, or we wind up with loop PolyLines when // Need to do a first pass of removing cul-de-sacs here, or we wind up with loop PolyLines when
// doing the parking hint matching. // doing the parking hint matching.

View File

@ -12,6 +12,7 @@ fn main() {
neighborhoods: args.optional("--neighborhoods"), neighborhoods: args.optional("--neighborhoods"),
elevation: args.optional("--elevation"), elevation: args.optional("--elevation"),
clip: args.optional("--clip"), clip: args.optional("--clip"),
drive_on_right: args.true_false("--drive_on_right"),
output: args.required("--output"), output: args.required("--output"),
}; };
args.done(); args.done();

View File

@ -292,7 +292,7 @@ fn is_road(tags: &BTreeMap<String, String>) -> bool {
// https://github.com/Project-OSRM/osrm-backend/blob/master/profiles/car.lua is another // https://github.com/Project-OSRM/osrm-backend/blob/master/profiles/car.lua is another
// potential reference // potential reference
for &value in &[ for value in &[
// List of non-car types from https://wiki.openstreetmap.org/wiki/Key:highway // List of non-car types from https://wiki.openstreetmap.org/wiki/Key:highway
// TODO Footways are very useful, but they need more work to associate with main roads // TODO Footways are very useful, but they need more work to associate with main roads
"footway", "footway",
@ -315,8 +315,9 @@ fn is_road(tags: &BTreeMap<String, String>) -> bool {
"elevator", "elevator",
"planned", "planned",
"razed", "razed",
"corridor",
] { ] {
if tags.get(osm::HIGHWAY) == Some(&String::from(value)) { if tags.get(osm::HIGHWAY) == Some(&value.to_string()) {
return false; return false;
} }
} }

View File

@ -86,13 +86,13 @@ d14c96851d6289b867e008432f54320d data/input/neighborhoods/caphill/Broadway.json
955835e85d15a2fb6c4a8586b8e5cb73 data/input/neighborhoods/caphill/Montlake.json 955835e85d15a2fb6c4a8586b8e5cb73 data/input/neighborhoods/caphill/Montlake.json
19e8073a9f6c807b4492681b2c7570de data/input/blockface.bin 19e8073a9f6c807b4492681b2c7570de data/input/blockface.bin
db63d7d606e8702d12f9399e87e6a00f data/input/parcels_urbansim.txt db63d7d606e8702d12f9399e87e6a00f data/input/parcels_urbansim.txt
532b8de03afe99b7ef4b3c2052160ac8 data/input/raw_maps/huge_seattle.bin 2e3e1ed2f874efb0e76fbe211cdf7439 data/input/raw_maps/huge_seattle.bin
9e35cdabc8bfb3566e98c55d7a6a4614 data/input/raw_maps/ballard.bin 4f5e19daf0801376e74004075b35d0dd data/input/raw_maps/ballard.bin
7b9649bf599345bb7bedd574523d9bd1 data/input/raw_maps/downtown.bin b0fe8b85fde16297ee5fa45968b18c79 data/input/raw_maps/downtown.bin
b6c40ae3292373bc4bfc9eff6cb6ee8a data/input/raw_maps/caphill.bin 95fdbcbc2b391479023889004cda2f62 data/input/raw_maps/caphill.bin
c891798df896dc8597402f64920fefa4 data/input/raw_maps/montlake.bin eec626656dc98e730d8d9c5902f63286 data/input/raw_maps/montlake.bin
27d283af09d2863325f5d32cadd482a0 data/input/raw_maps/intl_district.bin ba959d6ba6e80bc882dfb645487f972d data/input/raw_maps/intl_district.bin
dcb6ddd5249cd89295aed2becaf8c472 data/input/raw_maps/23rd.bin 63be0821f6a0fae1a88e0ea094a645ca data/input/raw_maps/23rd.bin
2bc84e4d194d7cea6007ae3b93f3b11b data/input/neighborhoods.geojson 2bc84e4d194d7cea6007ae3b93f3b11b data/input/neighborhoods.geojson
9cd47678c7f9dfc2cb80d79f90699d6f data/input/offstreet_parking.kml 9cd47678c7f9dfc2cb80d79f90699d6f data/input/offstreet_parking.kml
946f8d43a49fb9238c15670e4e928319 data/input/popdat.bin 946f8d43a49fb9238c15670e4e928319 data/input/popdat.bin
@ -106,7 +106,7 @@ dcb6ddd5249cd89295aed2becaf8c472 data/input/raw_maps/23rd.bin
e510730c57bcc1ed6671cc95ea257585 data/input/screenshots/montlake/02x05_i124.png e510730c57bcc1ed6671cc95ea257585 data/input/screenshots/montlake/02x05_i124.png
681c82d0767ea71a55ce183c14e816c0 data/input/screenshots/montlake/01x06_i26.png 681c82d0767ea71a55ce183c14e816c0 data/input/screenshots/montlake/01x06_i26.png
1717bfb53aa375bd3359de6e7db860ff data/input/screenshots/montlake/01x01_i19.png 1717bfb53aa375bd3359de6e7db860ff data/input/screenshots/montlake/01x01_i19.png
63a920add8f7d4da115ea56e52677d9b data/input/screenshots/montlake/MANIFEST 4b8efeae8a50f079cb6e0c56554aa724 data/input/screenshots/montlake/MANIFEST
0ece3a6bc65266c96c10ecb11f6738f9 data/input/screenshots/montlake/03x06_i27.png 0ece3a6bc65266c96c10ecb11f6738f9 data/input/screenshots/montlake/03x06_i27.png
19394b3b1c0208244cfdcac805414325 data/input/screenshots/montlake/02x03_i1.png 19394b3b1c0208244cfdcac805414325 data/input/screenshots/montlake/02x03_i1.png
612d5c710d77ae2fcd639fc8c1716dac data/input/screenshots/montlake/02x04_i25.png 612d5c710d77ae2fcd639fc8c1716dac data/input/screenshots/montlake/02x04_i25.png
@ -118,7 +118,7 @@ d6db692ef068337e5758de7be568f885 data/input/screenshots/montlake/03x01_i0.png
3ab7c23b54d9bfeac190fc3d5f0c75b1 data/input/screenshots/montlake/01x03_i4.png 3ab7c23b54d9bfeac190fc3d5f0c75b1 data/input/screenshots/montlake/01x03_i4.png
924811cfa5520f1fd3da1ef06b1a5c0c data/input/screenshots/montlake/01x02_i20.png 924811cfa5520f1fd3da1ef06b1a5c0c data/input/screenshots/montlake/01x02_i20.png
b1929464274d34c3bce5040821f7869d data/input/screenshots/montlake/03x04_i112.png b1929464274d34c3bce5040821f7869d data/input/screenshots/montlake/03x04_i112.png
94acbdf117cd18491f8360754089da2b data/input/screenshots/montlake/03x03_i59.png d268f5b8b3624b199b561cf6ae22f272 data/input/screenshots/montlake/03x03_i59.png
8b5c174350141b6411fa2f0dcb802b34 data/input/screenshots/montlake/02x01_i24.png 8b5c174350141b6411fa2f0dcb802b34 data/input/screenshots/montlake/02x01_i24.png
0cfba587f63ae66e59dc6961e4aab07b data/input/screenshots/montlake/03x05_i2.png 0cfba587f63ae66e59dc6961e4aab07b data/input/screenshots/montlake/03x05_i2.png
c9958a511d116460d48ff0a4093a7623 data/input/screenshots/montlake/02x06_i85.png c9958a511d116460d48ff0a4093a7623 data/input/screenshots/montlake/02x06_i85.png
@ -205,21 +205,21 @@ a5e849fa8883569519976ebfef3ae269 data/system/night_colors.json
517a360397bbb5a7573c2558e78fa4ea data/system/fonts/DejaVuSans.ttf 517a360397bbb5a7573c2558e78fa4ea data/system/fonts/DejaVuSans.ttf
e07df86cef2e721115583d61d1fb68a6 data/system/fonts/Roboto-Bold.ttf e07df86cef2e721115583d61d1fb68a6 data/system/fonts/Roboto-Bold.ttf
11eabca2251325cfc5589c9c6fb57b46 data/system/fonts/Roboto-Regular.ttf 11eabca2251325cfc5589c9c6fb57b46 data/system/fonts/Roboto-Regular.ttf
4f2e06aa2b49d7a8d88a62fbb29f845d data/system/maps/huge_seattle.bin 4479431e28c462b51188b6baa2accc2c data/system/maps/huge_seattle.bin
fa82daf6ce9380b7933eb792d2827fd5 data/system/maps/ballard.bin b21b307ce6c7f9823077ef734283a923 data/system/maps/ballard.bin
b513d9b8898bf4f182e9f56806ea776f data/system/maps/downtown.bin f3e9120b7ff4f397701f46042dc8b96a data/system/maps/downtown.bin
36721fcc6db31f8ca1bc0205ab286328 data/system/maps/caphill.bin 644050bd0eb650ee2b9aef3952765a78 data/system/maps/caphill.bin
9db50445605d901230a47a25b775f5e7 data/system/maps/montlake.bin 7a08ce1181bd2776f955be13e719215e data/system/maps/montlake.bin
a9f1e53561af81158e3d25ef40a4c70e data/system/maps/intl_district.bin 14a66b041f9f9cb7c51b70761486c776 data/system/maps/intl_district.bin
7a924369483f4f43d9d04ebffeb433f6 data/system/maps/23rd.bin 5fde6b37d47864188fe78132b6f76193 data/system/maps/23rd.bin
bd719a801b06c4191229b1991f58cadd data/system/synthetic_maps/signal_double.json 95ad0a3f0f1c920b194fcb252311db42 data/system/synthetic_maps/signal_double.json
75ea1d3aafa7fed11eeffe80949a8613 data/system/synthetic_maps/signal_single.json ec25a349e24363b413303858da5818c9 data/system/synthetic_maps/signal_single.json
75828c890af7ba001e3c4a6a81ddb4f6 data/system/synthetic_maps/signal_fan_in.json 33176acb73a16a0a05206f78c3edc735 data/system/synthetic_maps/signal_fan_in.json
c3fc9600f17f6da3066632f4ffb24b19 data/system/scenarios/ballard/weekday.bin c3fc9600f17f6da3066632f4ffb24b19 data/system/scenarios/ballard/weekday.bin
bd654abaa8640af5552e77402de95564 data/system/scenarios/intl_district/weekday.bin bd654abaa8640af5552e77402de95564 data/system/scenarios/intl_district/weekday.bin
31f908a30af3b11d985efb38fab399d5 data/system/scenarios/23rd/weekday.bin 31f908a30af3b11d985efb38fab399d5 data/system/scenarios/23rd/weekday.bin
f9c376fed1c3342605c0eb21664c000a data/system/scenarios/downtown/weekday.bin ffa7de5ea5a9000160f05a9c37b01ba9 data/system/scenarios/downtown/weekday.bin
4accdf621f9b96c95a9daf9b7d60cc76 data/system/scenarios/huge_seattle/weekday.bin 4e31f0b21f8692b1e160a00760b222e6 data/system/scenarios/huge_seattle/weekday.bin
0e81cca0bffeee701452c4a512881508 data/system/scenarios/caphill/weekday.bin 0e81cca0bffeee701452c4a512881508 data/system/scenarios/caphill/weekday.bin
315f8ac4ff4374c2eda609280c7dce01 data/system/scenarios/montlake/weekday.bin 315f8ac4ff4374c2eda609280c7dce01 data/system/scenarios/montlake/weekday.bin
aca1bff071cecad4683254b95c5570d1 data/system/prebaked_results/23rd/weekday.bin aca1bff071cecad4683254b95c5570d1 data/system/prebaked_results/23rd/weekday.bin

View File

@ -6,7 +6,7 @@ d6db692ef068337e5758de7be568f885 ../data/input/screenshots/pending_montlake/03x
88423d807e30c66547d7d0bf7dffd788 ../data/input/screenshots/pending_montlake/03x02_i8.png 88423d807e30c66547d7d0bf7dffd788 ../data/input/screenshots/pending_montlake/03x02_i8.png
3ab7c23b54d9bfeac190fc3d5f0c75b1 ../data/input/screenshots/pending_montlake/01x03_i4.png 3ab7c23b54d9bfeac190fc3d5f0c75b1 ../data/input/screenshots/pending_montlake/01x03_i4.png
19394b3b1c0208244cfdcac805414325 ../data/input/screenshots/pending_montlake/02x03_i1.png 19394b3b1c0208244cfdcac805414325 ../data/input/screenshots/pending_montlake/02x03_i1.png
94acbdf117cd18491f8360754089da2b ../data/input/screenshots/pending_montlake/03x03_i59.png d268f5b8b3624b199b561cf6ae22f272 ../data/input/screenshots/pending_montlake/03x03_i59.png
920eaf9c480d89e68234b399fecce33a ../data/input/screenshots/pending_montlake/01x04_i31.png 920eaf9c480d89e68234b399fecce33a ../data/input/screenshots/pending_montlake/01x04_i31.png
612d5c710d77ae2fcd639fc8c1716dac ../data/input/screenshots/pending_montlake/02x04_i25.png 612d5c710d77ae2fcd639fc8c1716dac ../data/input/screenshots/pending_montlake/02x04_i25.png
b1929464274d34c3bce5040821f7869d ../data/input/screenshots/pending_montlake/03x04_i112.png b1929464274d34c3bce5040821f7869d ../data/input/screenshots/pending_montlake/03x04_i112.png

View File

@ -382,5 +382,6 @@
"min_lat": 47.71442670283013, "min_lat": 47.71442670283013,
"max_lon": -122.44015604243269, "max_lon": -122.44015604243269,
"max_lat": 47.7155 "max_lat": 47.7155
} },
"drive_on_right": true
} }

View File

@ -593,5 +593,6 @@
"min_lat": 47.71465752631093, "min_lat": 47.71465752631093,
"max_lon": -122.43950238710731, "max_lon": -122.43950238710731,
"max_lat": 47.7155 "max_lat": 47.7155
} },
"drive_on_right": true
} }

View File

@ -435,5 +435,6 @@
"min_lat": 47.71357165572569, "min_lat": 47.71357165572569,
"max_lon": -122.43803830652608, "max_lon": -122.43803830652608,
"max_lat": 47.7155 "max_lat": 47.7155
} },
"drive_on_right": true
} }

View File

@ -15,6 +15,7 @@ everything [from source](INSTRUCTIONS.md).
cd convert_osm cd convert_osm
cargo run --release -- \ cargo run --release -- \
--osm=../data/input/osm/your_city.osm \ --osm=../data/input/osm/your_city.osm \
--drive_on_right=true|false \
--output=../data/input/raw_maps/your_city.bin --output=../data/input/raw_maps/your_city.bin
cd ../precompute cd ../precompute
cargo run --release -- ../data/input/raw_maps/your_city.bin cargo run --release -- ../data/input/raw_maps/your_city.bin

View File

@ -117,6 +117,7 @@ for poly in `ls ../data/input/polygons/`; do
--neighborhoods=../data/input/neighborhoods.geojson \ --neighborhoods=../data/input/neighborhoods.geojson \
--elevation=../data/input/N47W122.hgt \ --elevation=../data/input/N47W122.hgt \
--clip=../data/input/polygons/$name.poly \ --clip=../data/input/polygons/$name.poly \
--drive_on_right=true \
--output=../data/input/raw_maps/$name.bin --output=../data/input/raw_maps/$name.bin
#--sidewalks=../data/input/sidewalks.bin \ #--sidewalks=../data/input/sidewalks.bin \
done done

View File

@ -38,6 +38,7 @@ pub struct Map {
gps_bounds: GPSBounds, gps_bounds: GPSBounds,
bounds: Bounds, bounds: Bounds,
pub(crate) drive_on_right: bool,
turn_lookup: Vec<TurnID>, turn_lookup: Vec<TurnID>,
// TODO Argh, hack, initialization order is hard! // TODO Argh, hack, initialization order is hard!
@ -98,6 +99,7 @@ impl Map {
traffic_signals: BTreeMap::new(), traffic_signals: BTreeMap::new(),
gps_bounds: GPSBounds::new(), gps_bounds: GPSBounds::new(),
bounds: Bounds::new(), bounds: Bounds::new(),
drive_on_right: true,
turn_lookup: Vec::new(), turn_lookup: Vec::new(),
pathfinder: None, pathfinder: None,
pathfinder_dirty: false, pathfinder_dirty: false,
@ -800,6 +802,7 @@ fn make_half_map(
traffic_signals: BTreeMap::new(), traffic_signals: BTreeMap::new(),
gps_bounds, gps_bounds,
bounds, bounds,
drive_on_right: raw.drive_on_right,
turn_lookup: Vec::new(), turn_lookup: Vec::new(),
pathfinder: None, pathfinder: None,
pathfinder_dirty: false, pathfinder_dirty: false,

View File

@ -30,6 +30,9 @@ pub struct RawMap {
pub boundary_polygon: Polygon, pub boundary_polygon: Polygon,
pub gps_bounds: GPSBounds, pub gps_bounds: GPSBounds,
// If true, driving happens on the right side of the road (USA). If false, on the left
// (Australia).
pub drive_on_right: bool,
} }
// A way to refer to roads across many maps. // A way to refer to roads across many maps.
@ -95,6 +98,7 @@ impl RawMap {
// Some nonsense thing // Some nonsense thing
boundary_polygon: Polygon::rectangle(1.0, 1.0), boundary_polygon: Polygon::rectangle(1.0, 1.0),
gps_bounds: GPSBounds::new(), gps_bounds: GPSBounds::new(),
drive_on_right: true,
} }
} }

View File

@ -399,6 +399,7 @@ impl Road {
"???".to_string() "???".to_string()
} }
// Used to determine which roads have stop signs when roads of different types intersect.
pub fn get_rank(&self) -> usize { pub fn get_rank(&self) -> usize {
if let Some(highway) = self.osm_tags.get(osm::HIGHWAY) { if let Some(highway) = self.osm_tags.get(osm::HIGHWAY) {
match highway.as_ref() { match highway.as_ref() {
@ -424,6 +425,9 @@ impl Road {
"unclassified" => 0, "unclassified" => 0,
"road" => 0, "road" => 0,
"crossing" => 0, "crossing" => 0,
// If you hit this error and the highway type doesn't represent a driveable road,
// you may want to instead filter out the OSM way entirely in
// convert_osm/src/osm_reader.rs's is_road().
_ => panic!("Unknown OSM highway {}", highway), _ => panic!("Unknown OSM highway {}", highway),
} }
} else { } else {