script to reimport and reprecompute a single map. add golf course areas.

This commit is contained in:
Dustin Carlino 2019-02-14 18:45:42 -08:00
parent b366a2dccd
commit 0c81234b56
3 changed files with 46 additions and 3 deletions

View File

@ -36,8 +36,8 @@ pub struct Flags {
#[structopt(long = "residential_buildings")] #[structopt(long = "residential_buildings")]
pub residential_buildings: String, pub residential_buildings: String,
/// ExtraShapes file with parcels, produced using the kml crate /// ExtraShapes file with parcels, produced using the kml crate. Optional.
#[structopt(long = "parcels")] #[structopt(long = "parcels", default_value = "")]
pub parcels: String, pub parcels: String,
/// ExtraShapes file with blockface, produced using the kml crate /// ExtraShapes file with blockface, produced using the kml crate
@ -80,7 +80,9 @@ pub fn convert(flags: &Flags, timer: &mut abstutil::Timer) -> raw_data::Map {
handle_residences(&mut map, &gps_bounds, &flags.residential_buildings, timer); handle_residences(&mut map, &gps_bounds, &flags.residential_buildings, timer);
use_parking_hints(&mut map, &gps_bounds, &flags.parking_shapes, timer); use_parking_hints(&mut map, &gps_bounds, &flags.parking_shapes, timer);
handle_parcels(&mut map, &gps_bounds, &flags.parcels, timer); if !flags.parcels.is_empty() {
handle_parcels(&mut map, &gps_bounds, &flags.parcels, timer);
}
handle_traffic_signals(&mut map, &gps_bounds, &flags.traffic_signals, timer); handle_traffic_signals(&mut map, &gps_bounds, &flags.traffic_signals, timer);
map.bus_routes = gtfs::load(&flags.gtfs).unwrap(); map.bus_routes = gtfs::load(&flags.gtfs).unwrap();

View File

@ -182,6 +182,9 @@ fn get_area_type(tags: &BTreeMap<String, String>) -> Option<AreaType> {
if tags.get("leisure") == Some(&"park".to_string()) { if tags.get("leisure") == Some(&"park".to_string()) {
return Some(AreaType::Park); return Some(AreaType::Park);
} }
if tags.get("leisure") == Some(&"golf_course".to_string()) {
return Some(AreaType::Park);
}
if tags.get("natural") == Some(&"wood".to_string()) { if tags.get("natural") == Some(&"wood".to_string()) {
return Some(AreaType::Park); return Some(AreaType::Park);
} }

38
import_and_precompute.sh Executable file
View File

@ -0,0 +1,38 @@
#!/bin/bash
set -e
release_mode=""
name=""
for arg in "$@"; do
if [ "$arg" == "--release" ]; then
release_mode="--release";
else
name=$arg;
fi
done
if [ "$name" == "" ]; then
echo "Pass a map name";
exit;
fi
# TODO Argh, copied code! Need to detangle all the scripts.
rm -rf data/neighborhoods/$name data/maps/${name}_*.abst;
cd convert_osm;
# Note the lack of parcels
RUST_BACKTRACE=1 cargo run $release_mode -- \
--osm=../data/input/$name.osm \
--elevation=../data/input/N47W122.hgt \
--traffic_signals=../data/input/traffic_signals.kml \
--residential_buildings=../data/input/residential_buildings.kml \
--parking_shapes=../data/shapes/blockface \
--gtfs=../data/input/google_transit_2018_18_08 \
--neighborhoods=../data/input/neighborhoods.geojson \
--clip=../data/polygons/$name.poly \
--output=../data/raw_maps/$name.abst
cd ../precompute;
RUST_BACKTRACE=1 cargo run $release_mode ../data/raw_maps/$name.abst --edits_name=no_edits;