rename data/maps to data/raw_maps

This commit is contained in:
Dustin Carlino 2018-10-19 19:20:42 -07:00
parent a3984ca9ec
commit 80121df78c
6 changed files with 19 additions and 10 deletions

2
.gitignore vendored
View File

@ -8,7 +8,7 @@ data/seattle_parcels.abst
data/ab_tests/*
data/edits/*
data/input/*
data/maps/*
data/neighborhoods/*
data/raw_maps/*
data/save/*
data/scenarios/*

View File

@ -218,3 +218,8 @@ Cool, good enough to start. whew.
- TODO: https://data-seattlecitygis.opendata.arcgis.com/datasets/channelization
- https://data-seattlecitygis.opendata.arcgis.com/datasets/street-signs
## Speeding up map loading
- can we use quadtrees for the expensive building/sidewalk matching?
- awkward to bring a rendering-layer concept in; dont otherwise care about lane polygons

View File

@ -3,6 +3,8 @@
## Example use cases
- https://www.reddit.com/r/SeattleWA/comments/9mtgkh/seven_places_to_add_bus_lanes_now/
- https://www.reddit.com/r/SeattleWA/comments/9oqkz9/how_traffic_patterns_will_change_after_seattles/
- https://www.reddit.com/r/Seattle/comments/9orqne/4_fresh_ideas_to_ease_seattles_coming_traffic/
## Groups that may be eventually interested

View File

@ -41,7 +41,7 @@ fn main() {
let load = flags.sim_flags.load.clone();
let (map, control_map, mut sim) = sim::load(flags.sim_flags, Some(sim::Tick::from_seconds(30)));
if load.contains("data/maps/") {
if load.contains("data/raw_maps/") {
if flags.big_sim {
sim.big_spawn(&map);
} else {

View File

@ -10,7 +10,7 @@ function get_if_needed {
fi
}
mkdir -p data/input data/maps
mkdir -p data/input data/raw_maps
# TODO refactor a variant for .zips?
if [ ! -f data/input/N47W122.hgt ]; then
@ -62,5 +62,5 @@ fi
COMMON="--elevation=../data/input/N47W122.hgt --traffic_signals=../data/input/TrafficSignals.shp --parcels=../data/seattle_parcels.abst --gtfs=../data/input/google_transit_2018_18_08 --neighborhoods=../data/input/neighborhoods.geojson"
cd convert_osm
time cargo run --release -- --osm=../data/input/montlake.osm $COMMON --output=../data/maps/montlake.abst
time cargo run --release -- --osm=../data/input/small_seattle.osm $COMMON --output=../data/maps/small_seattle.abst
time cargo run --release -- --osm=../data/input/montlake.osm $COMMON --output=../data/raw_maps/montlake.abst
time cargo run --release -- --osm=../data/input/small_seattle.osm $COMMON --output=../data/raw_maps/small_seattle.abst

View File

@ -31,7 +31,7 @@ pub struct SimFlags {
impl SimFlags {
pub fn for_test(run_name: &str) -> SimFlags {
SimFlags {
load: "../data/maps/montlake.abst".to_string(),
load: "../data/raw_maps/montlake.abst".to_string(),
rng_seed: Some(42),
run_name: run_name.to_string(),
edits_name: "no_edits".to_string(),
@ -47,7 +47,7 @@ pub fn load(flags: SimFlags, savestate_every: Option<Tick>) -> (Map, ControlMap,
let sim: Sim = abstutil::read_json(&flags.load).expect("loading sim state failed");
flame::end("read sim savestate");
let edits = load_edits(&sim.map_name, &flags);
let map_path = format!("../data/maps/{}.abst", sim.map_name);
let map_path = format!("../data/raw_maps/{}.abst", sim.map_name);
let map = Map::new(&map_path, edits.road_edits.clone())
.expect(&format!("Couldn't load map from {}", map_path));
let control_map = ControlMap::new(&map, edits.stop_signs, edits.traffic_signals);
@ -56,7 +56,7 @@ pub fn load(flags: SimFlags, savestate_every: Option<Tick>) -> (Map, ControlMap,
info!("Seeding the simulation from scenario {}", flags.load);
let scenario: Scenario = abstutil::read_json(&flags.load).expect("loading scenario failed");
let edits = load_edits(&scenario.map_name, &flags);
let map_path = format!("../data/maps/{}.abst", scenario.map_name);
let map_path = format!("../data/raw_maps/{}.abst", scenario.map_name);
let map = Map::new(&map_path, edits.road_edits.clone())
.expect(&format!("Couldn't load map from {}", map_path));
let control_map = ControlMap::new(&map, edits.stop_signs, edits.traffic_signals);
@ -69,11 +69,11 @@ pub fn load(flags: SimFlags, savestate_every: Option<Tick>) -> (Map, ControlMap,
);
scenario.instantiate(&mut sim, &map);
(map, control_map, sim)
} else {
} else if flags.load.contains("data/raw_maps/") {
// TODO relative dir is brittle; match more cautiously
let map_name = flags
.load
.trim_left_matches("../data/maps/")
.trim_left_matches("../data/raw_maps/")
.trim_right_matches(".abst")
.to_string();
info!("Loading map {}", flags.load);
@ -84,6 +84,8 @@ pub fn load(flags: SimFlags, savestate_every: Option<Tick>) -> (Map, ControlMap,
let sim = Sim::new(&map, flags.run_name, flags.rng_seed, savestate_every);
flame::end("create sim");
(map, control_map, sim)
} else {
panic!("Don't know how to load {}", flags.load);
}
}