mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-24 09:24:26 +03:00
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:
parent
030191ef31
commit
18baf7ae49
@ -1,7 +1,6 @@
|
||||
mod clip;
|
||||
mod neighborhoods;
|
||||
mod osm;
|
||||
mod remove_disconnected;
|
||||
mod split_ways;
|
||||
|
||||
use abstutil::{prettyprint_usize, Timer};
|
||||
@ -55,7 +54,6 @@ pub fn convert(flags: &Flags, timer: &mut abstutil::Timer) -> raw_data::Map {
|
||||
let mut map =
|
||||
split_ways::split_up_roads(osm::extract_osm(&flags.osm, &flags.clip, timer), timer);
|
||||
clip::clip_map(&mut map, timer);
|
||||
remove_disconnected::remove_disconnected_roads(&mut map, timer);
|
||||
check_orig_ids(&map);
|
||||
|
||||
if flags.fast_dev {
|
||||
|
@ -122,12 +122,6 @@ it only takes a few seconds to load a serialized map.
|
||||
to preserve lots of out-of-bounds geometry.
|
||||
- Area polygons are intersected with the boundary polygon using the `clipping`
|
||||
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
|
||||
- Match each blockface to the nearest edge of a road
|
||||
- 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
|
||||
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
|
||||
parking hints to figure out what lanes are on each side of each road, also
|
||||
figuring out the total width of the road.
|
||||
|
@ -3,6 +3,7 @@ mod bus_stops;
|
||||
mod half_map;
|
||||
mod initial;
|
||||
mod parking_blackholes;
|
||||
mod remove_disconnected;
|
||||
mod sidewalk_finder;
|
||||
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::{Hint, Hints, InitialMap};
|
||||
pub use self::parking_blackholes::redirect_parking_blackholes;
|
||||
pub use self::remove_disconnected::remove_disconnected_roads;
|
||||
pub use self::turns::make_all_turns;
|
||||
|
@ -1,5 +1,5 @@
|
||||
use crate::raw_data;
|
||||
use abstutil::{retain_btreemap, MultiMap, Timer};
|
||||
use map_model::raw_data;
|
||||
use std::collections::HashSet;
|
||||
|
||||
pub fn remove_disconnected_roads(map: &mut raw_data::Map, timer: &mut Timer) {
|
@ -53,6 +53,8 @@ impl Map {
|
||||
pub fn new(path: &str, timer: &mut Timer) -> Result<Map, io::Error> {
|
||||
let mut data: raw_data::Map = abstutil::read_binary(path, 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))
|
||||
}
|
||||
|
||||
|
@ -166,6 +166,7 @@ pub struct Area {
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq)]
|
||||
pub struct OriginalRoad {
|
||||
// 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
|
||||
// upstream, but as long as everything is internally consistent within A/B Street...
|
||||
pub osm_way_id: i64,
|
||||
|
Loading…
Reference in New Issue
Block a user