explicitly allow osm highway types, instead of trying to deny stuff.

part of #231. handles construction much better.
This commit is contained in:
Dustin Carlino 2020-07-25 17:06:09 -07:00
parent 0c15b06922
commit fe41928cc8
5 changed files with 92 additions and 74 deletions

View File

@ -344,73 +344,62 @@ pub fn extract_osm(map: &mut RawMap, opts: &Options, timer: &mut Timer) -> OsmEx
}
fn is_road(tags: &mut Tags, opts: &Options) -> bool {
// First deal with railways.
if tags.is("railway", "light_rail") {
return true;
}
if tags.is("railway", "rail") && opts.include_railroads {
return true;
}
// TODO Because trams overlap with roads, they're harder:
// https://github.com/dabreegster/abstreet/issues/141
// Explicitly need this to avoid overlapping geometry in Berlin.
if tags.is("railway", "tram") {
return false;
}
if tags.is("area", "yes") {
return false;
}
if !tags.contains_key(osm::HIGHWAY) {
let highway = if let Some(x) = tags.get(osm::HIGHWAY) {
if x == "construction" {
// What exactly is under construction?
if let Some(x) = tags.get("construction") {
x
} else {
return false;
}
} else {
x
}
} else {
return false;
}
};
// https://github.com/Project-OSRM/osrm-backend/blob/master/profiles/car.lua is another
// potential reference
if tags.is_any(
osm::HIGHWAY,
vec![
// 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
"footway",
"pedestrian",
"stairs",
"track",
"bus_guideway",
"escape",
"raceway",
"bridleway",
"steps",
"path",
"cycleway",
"proposed",
// more discovered manually
"abandoned",
"elevator",
"planned",
"razed",
"corridor",
"junction",
"bus_stop",
"no",
"platform",
],
) {
if !vec![
"living_street",
"motorway",
"motorway_link",
"primary",
"primary_link",
"residential",
"secondary",
"secondary_link",
"service",
"tertiary",
"tertiary_link",
"trunk",
"trunk_link",
"unclassified",
]
.contains(&highway.as_ref())
{
return false;
}
// Service roads can represent lots of things, most of which we don't want to keep yet. What's
// allowed here is just based on what's been encountered so far in Seattle and Kraków.
if tags.is(osm::HIGHWAY, "service") {
if !tags.is("psv", "yes") && !tags.is("bus", "yes") {
return false;
}
}
if tags.is(osm::HIGHWAY, "construction")
&& tags.is_any("construction", vec!["footway", "service"])
{
if highway == "service" && !tags.is("psv", "yes") && !tags.is("bus", "yes") {
return false;
}
// It's a road! Now fill in some possibly missing data.
// If there's no parking data in OSM already, then assume no parking and mark that it's
// inferred.
if !tags.contains_key(osm::PARKING_LEFT)

View File

@ -5,21 +5,21 @@ data/input/berlin/planning_areas.bin,f1a3bd5118a0e4982b64c2307e01d82a,https://ww
data/input/berlin/planning_areas.kml,1bfc2044f1f5f40acdcdded1a644ad22,https://www.dropbox.com/s/9bvbshrtjw14tm7/planning_areas.kml.zip?dl=0
data/input/krakow/osm/huge_krakow.osm,b914bbcd42a7f769a40a90970cea35f2,https://www.dropbox.com/s/bhh14m5mxh2r4l1/huge_krakow.osm.zip?dl=0
data/input/krakow/osm/malopolskie-latest.osm.pbf,9505917bbacc478177e36605e89b6d77,https://www.dropbox.com/s/vehjfvwx25v1qnd/malopolskie-latest.osm.pbf.zip?dl=0
data/input/raw_maps/ballard.bin,0635e96f819965e1ca8a22d2857258f5,https://www.dropbox.com/s/aocc7igjwu7ox0w/ballard.bin.zip?dl=0
data/input/raw_maps/berlin_center.bin,edb39fa27fb26d5d0259238556b778e0,https://www.dropbox.com/s/zbohdt7qee48t65/berlin_center.bin.zip?dl=0
data/input/raw_maps/downtown.bin,677a97360a28d5b9d56412094492bec3,https://www.dropbox.com/s/jh6euqnimsii0ni/downtown.bin.zip?dl=0
data/input/raw_maps/huge_krakow.bin,ee714f1282432a26b9439ea2321ae9df,https://www.dropbox.com/s/upewqp9265u8aly/huge_krakow.bin.zip?dl=0
data/input/raw_maps/huge_seattle.bin,d721088c982a08d740db7e28c0a2466d,https://www.dropbox.com/s/8yqa5765a7jy5dk/huge_seattle.bin.zip?dl=0
data/input/raw_maps/ballard.bin,cd3899076e2da01bb9b2e53ee607d6e5,https://www.dropbox.com/s/0a8r2f1f6ynsim0/ballard.bin.zip?dl=0
data/input/raw_maps/berlin_center.bin,c84739485e8d701986b070c9f8c746ac,https://www.dropbox.com/s/sklgidzxozj1kgv/berlin_center.bin.zip?dl=0
data/input/raw_maps/downtown.bin,531dccce65566a5648e72008ff08ab42,https://www.dropbox.com/s/30etfefs6iuqdla/downtown.bin.zip?dl=0
data/input/raw_maps/huge_krakow.bin,7d9cefc0e5882ce409f88381ba0bd2ec,https://www.dropbox.com/s/65djc276s986ee8/huge_krakow.bin.zip?dl=0
data/input/raw_maps/huge_seattle.bin,0f587adc770a986ae99cb318b234d920,https://www.dropbox.com/s/la4578lo7avkf31/huge_seattle.bin.zip?dl=0
data/input/raw_maps/lakeslice.bin,06351cd351b629584e6b3860a77c7366,https://www.dropbox.com/s/l4pb1p24kzolq3y/lakeslice.bin.zip?dl=0
data/input/raw_maps/montlake.bin,b47b1603d167d3832929e4df5b7d6c7f,https://www.dropbox.com/s/ph2xy1buu4pw893/montlake.bin.zip?dl=0
data/input/raw_maps/south_seattle.bin,9d02327296b4c90c3d041b45c3736fc4,https://www.dropbox.com/s/vmc3x64xc5ghrax/south_seattle.bin.zip?dl=0
data/input/raw_maps/udistrict.bin,0a6c68a16020de0e484e8c729e6084d4,https://www.dropbox.com/s/wpq2z8a39spbbmb/udistrict.bin.zip?dl=0
data/input/raw_maps/west_seattle.bin,ef69e974437817ae6672547defb54891,https://www.dropbox.com/s/k302zpwz2sdtfqw/west_seattle.bin.zip?dl=0
data/input/screenshots/downtown.zip,9a608788b35bdc8cbffb0208f1a14dd1,https://www.dropbox.com/s/qawd35wz62m2acl/downtown.zip.zip?dl=0
data/input/screenshots/huge_krakow.zip,87a3a2cd86fdfe39a9d9b9a5e22362d8,https://www.dropbox.com/s/dbzon7k5ukndtza/huge_krakow.zip.zip?dl=0
data/input/screenshots/lakeslice.zip,eeafac978248dc6b4b425df9fa19ef6a,https://www.dropbox.com/s/z0z96lsn7bunqfy/lakeslice.zip.zip?dl=0
data/input/screenshots/montlake.zip,3f51486d7fd8ff87e90147497d3da152,https://www.dropbox.com/s/ku5x06hdt0omway/montlake.zip.zip?dl=0
data/input/screenshots/udistrict.zip,48baa273887cefcf82be73d8e31dbb0c,https://www.dropbox.com/s/ecnt1tyza48y9o2/udistrict.zip.zip?dl=0
data/input/screenshots/downtown.zip,b45b7699c7f53e39317349d0e8dc35b1,https://www.dropbox.com/s/qawd35wz62m2acl/downtown.zip.zip?dl=0
data/input/screenshots/huge_krakow.zip,c5efdff90096e977929364f05ae91248,https://www.dropbox.com/s/dbzon7k5ukndtza/huge_krakow.zip.zip?dl=0
data/input/screenshots/lakeslice.zip,fb23ebfecb673cb41aab4027baa80d1f,https://www.dropbox.com/s/z0z96lsn7bunqfy/lakeslice.zip.zip?dl=0
data/input/screenshots/montlake.zip,fb21d1380df145990c83fc050d564ba3,https://www.dropbox.com/s/ku5x06hdt0omway/montlake.zip.zip?dl=0
data/input/screenshots/udistrict.zip,1beaa62325d6f681a52c9937379ebccf,https://www.dropbox.com/s/ecnt1tyza48y9o2/udistrict.zip.zip?dl=0
data/input/seattle/N47W122.hgt,0db4e23e51f7680538b0bbbc72208e07,https://www.dropbox.com/s/mmb4mgutwotijdw/N47W122.hgt.zip?dl=0
data/input/seattle/blockface.bin,add872bab9040ae911366328a230f8b5,https://www.dropbox.com/s/rxd2care60tbe75/blockface.bin.zip?dl=0
data/input/seattle/blockface.kml,350bd9e59bf2af4e885a7c0741e6ee6b,https://www.dropbox.com/s/ukknmpjdvilncq9/blockface.kml.zip?dl=0
@ -34,29 +34,29 @@ data/input/seattle/osm/south_seattle.osm,1107f8b545b09731c4619fde63bdbaed,https:
data/input/seattle/osm/udistrict.osm,ed26f2405c07c63161e902bcb5049fab,https://www.dropbox.com/s/ozqk7lb5nn0wace/udistrict.osm.zip?dl=0
data/input/seattle/osm/washington-latest.osm.pbf,332c0bbd80621a52e3765381718f3454,https://www.dropbox.com/s/iitat4cnhj5dop8/washington-latest.osm.pbf.zip?dl=0
data/input/seattle/osm/west_seattle.osm,f829d6a1c87e782fafbc1552acc5a523,https://www.dropbox.com/s/3vlyve59lfo9s99/west_seattle.osm.zip?dl=0
data/input/seattle/parcels.bin,a006fbfaf8be0795968196191cccb2c9,https://www.dropbox.com/s/90sthlt4mtp2umt/parcels.bin.zip?dl=0
data/input/seattle/parcels.bin,6302c1098df5a4f27b155e0a8c755a6d,https://www.dropbox.com/s/o70xkijk2bqu6z9/parcels.bin.zip?dl=0
data/input/seattle/parcels_urbansim.txt,db63d7d606e8702d12f9399e87e6a00f,https://www.dropbox.com/s/6g8rbsf200dssj3/parcels_urbansim.txt.zip?dl=0
data/input/seattle/popdat.bin,0fd10698d2c6bf41da3d57804c617d15,https://www.dropbox.com/s/iboctakleznvslq/popdat.bin.zip?dl=0
data/input/seattle/trips_2014.csv,d4a8e733045b28c0385fb81359d6df03,https://www.dropbox.com/s/5ppravwmk6bf20d/trips_2014.csv.zip?dl=0
data/system/cities/seattle.bin,a188f684676b3a5c42d9caa5ae4403b4,https://www.dropbox.com/s/o7jy4jnxtpa9rpn/seattle.bin.zip?dl=0
data/system/maps/ballard.bin,c8a06ef7b9fdc6cdd6e61b72fd0c3ebd,https://www.dropbox.com/s/y8mkckmjevz7pcy/ballard.bin.zip?dl=0
data/system/maps/berlin_center.bin,9ff593253edc3fb8a42a440c9cd5c937,https://www.dropbox.com/s/mnmraw1ec9gwa94/berlin_center.bin.zip?dl=0
data/system/maps/ballard.bin,f83c59ab69f659be8c09ae2ec347ee7a,https://www.dropbox.com/s/6cmbsbslho2ec48/ballard.bin.zip?dl=0
data/system/maps/berlin_center.bin,bc8b384fb04972042786a17548ff1f83,https://www.dropbox.com/s/z4tgzqdopr1m1ip/berlin_center.bin.zip?dl=0
data/system/maps/downtown.bin,a87d10fafb1d7caf77bd9a563ee3b85a,https://www.dropbox.com/s/k0pd27jo7z33ddv/downtown.bin.zip?dl=0
data/system/maps/huge_krakow.bin,8d5140c44b1ca13d75af74fe13693b4b,https://www.dropbox.com/s/05byrf4mokxhfyi/huge_krakow.bin.zip?dl=0
data/system/maps/huge_seattle.bin,201423da8080b49bf0e03624d4fc9408,https://www.dropbox.com/s/bhe0ocgw8m8g8jo/huge_seattle.bin.zip?dl=0
data/system/maps/huge_krakow.bin,5cad6d2470434ad271e6ee99a8759864,https://www.dropbox.com/s/go8no153ktm4u9g/huge_krakow.bin.zip?dl=0
data/system/maps/huge_seattle.bin,01eed9ea15bc47df2ad0daee20bb644b,https://www.dropbox.com/s/63dtj89ol1j8zfp/huge_seattle.bin.zip?dl=0
data/system/maps/lakeslice.bin,768dcbfe4497aef914b6376b1681d2d5,https://www.dropbox.com/s/l03ojlgoasja3ji/lakeslice.bin.zip?dl=0
data/system/maps/montlake.bin,0ed0a8bb2b7f31a2951fe0856f538042,https://www.dropbox.com/s/4418p3gcdkdafcq/montlake.bin.zip?dl=0
data/system/maps/south_seattle.bin,bb032a08e8061aeeb5c7fc047442c8a3,https://www.dropbox.com/s/grk2n67oeeizms0/south_seattle.bin.zip?dl=0
data/system/maps/udistrict.bin,a9d85cd9b97e3facf8cbcad7f81b074e,https://www.dropbox.com/s/cte9rpnx6cfiyoh/udistrict.bin.zip?dl=0
data/system/maps/west_seattle.bin,83a3a98ac4f93d5618deda1ed19b8f05,https://www.dropbox.com/s/m3shzzxfzafegae/west_seattle.bin.zip?dl=0
data/system/prebaked_results/lakeslice/weekday.bin,5b1572a12a70c89337a6289821f7c353,https://www.dropbox.com/s/3jfgjng0a5lzxgu/weekday.bin.zip?dl=0
data/system/prebaked_results/lakeslice/weekday.bin,c0a06bbc1fc043116721c070d783e2aa,https://www.dropbox.com/s/gjiux87258t02bd/weekday.bin.zip?dl=0
data/system/prebaked_results/montlake/car vs bike contention.bin,9e4920cf59268cd169372cad63e772e3,https://www.dropbox.com/s/jefg0ikjy9dsrdd/car%20vs%20bike%20contention.bin.zip?dl=0
data/system/prebaked_results/montlake/weekday.bin,e25e23f9bda116aa68864efe24d6b67c,https://www.dropbox.com/s/pxwtsq4kvpgkrer/weekday.bin.zip?dl=0
data/system/scenarios/ballard/weekday.bin,127828d565c8acec2d48830fbe5ef024,https://www.dropbox.com/s/523u4xxne7k19ij/weekday.bin.zip?dl=0
data/system/scenarios/downtown/weekday.bin,0cbfe68cb2314a045f56144ede76817a,https://www.dropbox.com/s/tqunqfa6b6klg5l/weekday.bin.zip?dl=0
data/system/scenarios/huge_seattle/weekday.bin,3b79838b6fc1c255a726af3e9862957b,https://www.dropbox.com/s/blc88fsmn05mon3/weekday.bin.zip?dl=0
data/system/scenarios/lakeslice/weekday.bin,f19e6695b600d483494cfda579fe2f15,https://www.dropbox.com/s/w02ywjtaga6lk92/weekday.bin.zip?dl=0
data/system/scenarios/montlake/weekday.bin,ace337f91d77e71337f4cf3b503adf2a,https://www.dropbox.com/s/1jhdllo4qws3aoy/weekday.bin.zip?dl=0
data/system/scenarios/south_seattle/weekday.bin,583b1fa49b23385001a03e2108ee806e,https://www.dropbox.com/s/dcht6555hjbpjyg/weekday.bin.zip?dl=0
data/system/scenarios/udistrict/weekday.bin,1266564ca1ca62a1a511ac382b949e97,https://www.dropbox.com/s/ic79q9qlng68231/weekday.bin.zip?dl=0
data/system/scenarios/west_seattle/weekday.bin,e54986d5efd877a28df4024e1f7f5910,https://www.dropbox.com/s/9o5sp21rtbpiw6l/weekday.bin.zip?dl=0
data/system/prebaked_results/montlake/weekday.bin,3a58878144e0382751e2b028d80e25a4,https://www.dropbox.com/s/ezsb1pre6rfwdgw/weekday.bin.zip?dl=0
data/system/scenarios/ballard/weekday.bin,59cc7079dc4605a98ee0f9728adc22bf,https://www.dropbox.com/s/pkay781gazix3pu/weekday.bin.zip?dl=0
data/system/scenarios/downtown/weekday.bin,2e1bc5e3244be698ceb28f510530218f,https://www.dropbox.com/s/el3r6w29g9nlew7/weekday.bin.zip?dl=0
data/system/scenarios/huge_seattle/weekday.bin,06913d198d8e1d3b5e24e68cd4acd0ab,https://www.dropbox.com/s/hnupvvptqtqpzub/weekday.bin.zip?dl=0
data/system/scenarios/lakeslice/weekday.bin,80ab166be13ac3cd50295b3b6feab494,https://www.dropbox.com/s/vzd1eny95m6lgkb/weekday.bin.zip?dl=0
data/system/scenarios/montlake/weekday.bin,c151631c65f61e1272aac188069a7c0c,https://www.dropbox.com/s/pg7bk5hbgf1tch1/weekday.bin.zip?dl=0
data/system/scenarios/south_seattle/weekday.bin,6af91f91ba96cbdcb6fd257aa2b1974a,https://www.dropbox.com/s/y9yvryv9uw3voqq/weekday.bin.zip?dl=0
data/system/scenarios/udistrict/weekday.bin,7fc527c27f28ac30bcb90edd3b08ea58,https://www.dropbox.com/s/5m6k7zv30ejpih9/weekday.bin.zip?dl=0
data/system/scenarios/west_seattle/weekday.bin,c7b3cda412ec07bb36909626f4b759e7,https://www.dropbox.com/s/a3yc3itba9apsfj/weekday.bin.zip?dl=0

View File

@ -79,3 +79,26 @@ messy and for now, most of these aren't quite guaranteed to be true.
to border intersections -- if a car spawns on a highway along the border of
the map, it may be forced to disappear on the opposite border of the map, if
the highway happens to not have any exits within the map boundary.
## Connectivity
For a single mode, each lane is connected to two intersections. Turns connect
two lanes. There are no turns between sidewalks and driving/bike/bus lanes.
All buildings and parking lots have driveways. This must connect to a sidewalk,
allowing pedestrians to enter/exit that object. The driveway OPTIONALLY
connects to the nearest driveable lane. This allows cars to enter/exit that
object for parking.
Public transit stops are located somewhere on a sidewalk. They're associated
with a driveable position where the bus or train stops. In the future, this
will need to account for dedicated surface-level platforms and for underground
transit stations, likely associated with a building.
There's a concept of "parking blackholes." If you treat every road as
bidirectional without access restrictions, then the graph is connected. But the
more detailed view has to factor in one-way roads and things near the map
border. These blackholes influence where cars will try to look for parking
(since we don't want them entering a blackhole and getting stuck) and also, for
temporary/unintentional reasons, where pedestrian<->bicycle transitions will
happen.

View File

@ -1,3 +1,6 @@
# Importing
Overview of the process. The importer tool.
Don't be afraid of how complicated this seems. It started simple -- just bring
in OSM roads, chop into pieces, generate turns.

View File

@ -374,8 +374,11 @@ impl Road {
"service" => 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),
// convert_osm/src/extract.rs's is_road().
_ => panic!(
"Unknown OSM highway {}. Other tags: {:?}",
highway, self.osm_tags
),
}
} else {
0