remove disconnected roads from raw map later, not in convert_osm. that way, if MapFixes disconnect anything, it gets removed later

This commit is contained in:
Dustin Carlino 2019-09-17 09:41:38 -07:00
parent 030191ef31
commit 18baf7ae49
6 changed files with 12 additions and 9 deletions

View File

@ -1,7 +1,6 @@
mod clip; mod clip;
mod neighborhoods; mod neighborhoods;
mod osm; mod osm;
mod remove_disconnected;
mod split_ways; mod split_ways;
use abstutil::{prettyprint_usize, Timer}; use abstutil::{prettyprint_usize, Timer};
@ -55,7 +54,6 @@ pub fn convert(flags: &Flags, timer: &mut abstutil::Timer) -> raw_data::Map {
let mut map = let mut map =
split_ways::split_up_roads(osm::extract_osm(&flags.osm, &flags.clip, timer), timer); split_ways::split_up_roads(osm::extract_osm(&flags.osm, &flags.clip, timer), timer);
clip::clip_map(&mut map, timer); clip::clip_map(&mut map, timer);
remove_disconnected::remove_disconnected_roads(&mut map, timer);
check_orig_ids(&map); check_orig_ids(&map);
if flags.fast_dev { if flags.fast_dev {

View File

@ -122,12 +122,6 @@ it only takes a few seconds to load a serialized map.
to preserve lots of out-of-bounds geometry. to preserve lots of out-of-bounds geometry.
- Area polygons are intersected with the boundary polygon using the `clipping` - Area polygons are intersected with the boundary polygon using the `clipping`
crate crate
- `remove_disconnected.rs`: Remove disconnected roads
- Just floodfill from some road, assuming all roads are bidirectional, to get
different partitions.
- Remove roads from all but the largest partition
- Also remove cul-de-sacs (roads that begin and end at the same intersection),
because they mess up parking hints and pathfinding.
- `lib.rs`: Apply parking hints from a King County GIS blockface dataset - `lib.rs`: Apply parking hints from a King County GIS blockface dataset
- Match each blockface to the nearest edge of a road - Match each blockface to the nearest edge of a road
- Interpret the metadata to assign on-street parking there or not - Interpret the metadata to assign on-street parking there or not
@ -148,6 +142,12 @@ The remainder of map construction is done in the `map_model` crate, driven by
the `precompute.sh` script. There are two awkwardly named intermediate phases the `precompute.sh` script. There are two awkwardly named intermediate phases
before the final Map: InitialMap and HalfMap. before the final Map: InitialMap and HalfMap.
- `make/remove_disconnected.rs`: Remove disconnected roads
- Just floodfill from some road, assuming all roads are bidirectional, to get
different partitions.
- Remove roads from all but the largest partition
- Also remove cul-de-sacs (roads that begin and end at the same intersection),
because they mess up parking hints and pathfinding.
- `make/initial/mod.rs` and `make/initial/lane_specs.rs`: Interpret OSM tags and - `make/initial/mod.rs` and `make/initial/lane_specs.rs`: Interpret OSM tags and
parking hints to figure out what lanes are on each side of each road, also parking hints to figure out what lanes are on each side of each road, also
figuring out the total width of the road. figuring out the total width of the road.

View File

@ -3,6 +3,7 @@ mod bus_stops;
mod half_map; mod half_map;
mod initial; mod initial;
mod parking_blackholes; mod parking_blackholes;
mod remove_disconnected;
mod sidewalk_finder; mod sidewalk_finder;
mod turns; mod turns;
@ -12,4 +13,5 @@ pub use self::half_map::make_half_map;
pub use self::initial::lane_specs::{get_lane_types, RoadSpec}; pub use self::initial::lane_specs::{get_lane_types, RoadSpec};
pub use self::initial::{Hint, Hints, InitialMap}; pub use self::initial::{Hint, Hints, InitialMap};
pub use self::parking_blackholes::redirect_parking_blackholes; pub use self::parking_blackholes::redirect_parking_blackholes;
pub use self::remove_disconnected::remove_disconnected_roads;
pub use self::turns::make_all_turns; pub use self::turns::make_all_turns;

View File

@ -1,5 +1,5 @@
use crate::raw_data;
use abstutil::{retain_btreemap, MultiMap, Timer}; use abstutil::{retain_btreemap, MultiMap, Timer};
use map_model::raw_data;
use std::collections::HashSet; use std::collections::HashSet;
pub fn remove_disconnected_roads(map: &mut raw_data::Map, timer: &mut Timer) { pub fn remove_disconnected_roads(map: &mut raw_data::Map, timer: &mut Timer) {

View File

@ -53,6 +53,8 @@ impl Map {
pub fn new(path: &str, timer: &mut Timer) -> Result<Map, io::Error> { pub fn new(path: &str, timer: &mut Timer) -> Result<Map, io::Error> {
let mut data: raw_data::Map = abstutil::read_binary(path, timer)?; let mut data: raw_data::Map = abstutil::read_binary(path, timer)?;
data.apply_fixes(&raw_data::MapFixes::load(), timer); data.apply_fixes(&raw_data::MapFixes::load(), timer);
// Do this after applying fixes, which might split off pieces of the map.
make::remove_disconnected_roads(&mut data, timer);
Ok(Map::create_from_raw(abstutil::basename(path), data, timer)) Ok(Map::create_from_raw(abstutil::basename(path), data, timer))
} }

View File

@ -166,6 +166,7 @@ pub struct Area {
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq)] #[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq)]
pub struct OriginalRoad { pub struct OriginalRoad {
// This is needed to distinguish cul-de-sacs. // This is needed to distinguish cul-de-sacs.
// ... which is a bit weird, because we remove those in a later stage anyway.
// TODO Maybe replace pt1 and pt2 with OSM node IDs? OSM node IDs may change over time // TODO Maybe replace pt1 and pt2 with OSM node IDs? OSM node IDs may change over time
// upstream, but as long as everything is internally consistent within A/B Street... // upstream, but as long as everything is internally consistent within A/B Street...
pub osm_way_id: i64, pub osm_way_id: i64,