From 0c81234b561efb2c5a58b7ebf193eb9b5cbc7ceb Mon Sep 17 00:00:00 2001 From: Dustin Carlino Date: Thu, 14 Feb 2019 18:45:42 -0800 Subject: [PATCH] script to reimport and reprecompute a single map. add golf course areas. --- convert_osm/src/lib.rs | 8 +++++--- convert_osm/src/osm.rs | 3 +++ import_and_precompute.sh | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 3 deletions(-) create mode 100755 import_and_precompute.sh diff --git a/convert_osm/src/lib.rs b/convert_osm/src/lib.rs index 26d9a5b2d3..b332b6a2fb 100644 --- a/convert_osm/src/lib.rs +++ b/convert_osm/src/lib.rs @@ -36,8 +36,8 @@ pub struct Flags { #[structopt(long = "residential_buildings")] pub residential_buildings: String, - /// ExtraShapes file with parcels, produced using the kml crate - #[structopt(long = "parcels")] + /// ExtraShapes file with parcels, produced using the kml crate. Optional. + #[structopt(long = "parcels", default_value = "")] pub parcels: String, /// 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); 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); map.bus_routes = gtfs::load(&flags.gtfs).unwrap(); diff --git a/convert_osm/src/osm.rs b/convert_osm/src/osm.rs index bb6c3ef0f7..148ef4e34b 100644 --- a/convert_osm/src/osm.rs +++ b/convert_osm/src/osm.rs @@ -182,6 +182,9 @@ fn get_area_type(tags: &BTreeMap) -> Option { if tags.get("leisure") == Some(&"park".to_string()) { 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()) { return Some(AreaType::Park); } diff --git a/import_and_precompute.sh b/import_and_precompute.sh new file mode 100755 index 0000000000..99df68b7cb --- /dev/null +++ b/import_and_precompute.sh @@ -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;