2018-03-13 18:04:21 +03:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2019-07-02 17:43:28 +03:00
|
|
|
only_map=""
|
2019-08-26 21:22:21 +03:00
|
|
|
release="--release"
|
2019-07-02 17:43:28 +03:00
|
|
|
for arg in "$@"; do
|
2019-08-26 21:22:21 +03:00
|
|
|
if [ "$arg" == "--debug" ]; then
|
|
|
|
release="";
|
|
|
|
else
|
|
|
|
only_map=$arg;
|
|
|
|
fi
|
2019-07-02 17:43:28 +03:00
|
|
|
done
|
|
|
|
|
2018-10-04 08:26:56 +03:00
|
|
|
# First prepare input.
|
|
|
|
|
2018-10-03 17:47:59 +03:00
|
|
|
function get_if_needed {
|
|
|
|
if [ ! -f $2 ]; then
|
2019-11-24 18:21:30 +03:00
|
|
|
echo "Downloading $1";
|
2019-12-03 23:29:57 +03:00
|
|
|
curl -L -o $2 $1;
|
2018-10-03 17:47:59 +03:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2019-12-04 03:36:30 +03:00
|
|
|
mkdir -p data/input/osm data/input/raw_maps
|
2018-10-04 08:26:56 +03:00
|
|
|
|
|
|
|
# TODO refactor a variant for .zips?
|
|
|
|
if [ ! -d data/input/google_transit_2018_18_08/ ]; then
|
2018-11-08 21:43:42 +03:00
|
|
|
get_if_needed \
|
|
|
|
https://metro.kingcounty.gov/GTFS/google_transit_2018_18_08.zip \
|
|
|
|
data/input/google_transit_2018_18_08.zip;
|
2018-10-04 08:26:56 +03:00
|
|
|
unzip -d data/input/google_transit_2018_18_08 data/input/google_transit_2018_18_08.zip;
|
|
|
|
rm -f data/input/google_transit_2018_18_08.zip;
|
|
|
|
fi
|
|
|
|
|
2018-10-15 05:06:57 +03:00
|
|
|
if [ ! -f data/input/neighborhoods.geojson ]; then
|
|
|
|
# https://data.seattle.gov/dataset/Neighborhoods/2mbt-aqqx in GeoJSON, not SHP
|
2018-11-08 21:43:42 +03:00
|
|
|
get_if_needed \
|
|
|
|
https://github.com/seattleio/seattle-boundaries-data/raw/master/data/neighborhoods.geojson \
|
|
|
|
data/input/neighborhoods.geojson;
|
2018-10-15 05:06:57 +03:00
|
|
|
fi
|
|
|
|
|
2019-12-03 23:25:33 +03:00
|
|
|
if [ ! -f data/input/osm/Seattle.osm ]; then
|
2018-11-08 21:43:42 +03:00
|
|
|
get_if_needed \
|
|
|
|
http://download.bbbike.org/osm/bbbike/Seattle/Seattle.osm.gz \
|
2019-12-03 23:25:33 +03:00
|
|
|
data/input/osm/Seattle.osm.gz;
|
|
|
|
gunzip data/input/osm/Seattle.osm.gz;
|
2018-10-04 08:26:56 +03:00
|
|
|
fi
|
|
|
|
|
2019-09-28 20:44:46 +03:00
|
|
|
# PSRC data comes from https://github.com/psrc/soundcast/releases.
|
|
|
|
if [ ! -f data/input/parcels_urbansim.txt ]; then
|
|
|
|
get_if_needed https://www.dropbox.com/s/t9oug9lwhdwfc04/psrc_2014.zip?dl=0 data/input/psrc_2014.zip;
|
|
|
|
unzip data/input/psrc_2014.zip -d data/input;
|
|
|
|
rm -f data/input/psrc_2014.zip;
|
|
|
|
fi
|
|
|
|
|
2019-12-03 23:22:59 +03:00
|
|
|
for poly in `ls data/input/polygons/`; do
|
2018-10-30 01:12:45 +03:00
|
|
|
name=`basename -s .poly $poly`;
|
2019-12-03 23:25:33 +03:00
|
|
|
if [ ! -f data/input/osm/$name.osm ]; then
|
2019-10-27 01:01:27 +03:00
|
|
|
echo "Running osmconvert for $name"
|
2019-12-03 23:25:33 +03:00
|
|
|
osmconvert data/input/osm/Seattle.osm \
|
2019-12-03 23:22:59 +03:00
|
|
|
-B=data/input/polygons/$name.poly \
|
2019-10-26 19:52:36 +03:00
|
|
|
--complete-ways \
|
2019-12-03 23:25:33 +03:00
|
|
|
-o=data/input/osm/$name.osm
|
2018-10-30 01:12:45 +03:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2019-12-03 22:55:54 +03:00
|
|
|
if [ ! -f data/input/blockface.bin ]; then
|
2018-11-22 04:18:31 +03:00
|
|
|
# From http://data-seattlecitygis.opendata.arcgis.com/datasets/blockface
|
|
|
|
get_if_needed https://opendata.arcgis.com/datasets/a1458ad1abca41869b81f7c0db0cd777_0.kml data/input/blockface.kml;
|
|
|
|
|
|
|
|
cd kml
|
|
|
|
time cargo run --release -- \
|
|
|
|
--input=../data/input/blockface.kml \
|
2019-12-03 22:55:54 +03:00
|
|
|
--output=../data/input/blockface.bin
|
2019-12-04 06:28:58 +03:00
|
|
|
rm -f ../data/input/blockface.kml;
|
2018-11-22 04:18:31 +03:00
|
|
|
cd ..
|
|
|
|
fi
|
|
|
|
|
2019-12-03 22:55:54 +03:00
|
|
|
if [ ! -f data/input/sidewalks.bin ]; then
|
2019-10-23 19:35:41 +03:00
|
|
|
# From https://data-seattlecitygis.opendata.arcgis.com/datasets/sidewalks
|
|
|
|
get_if_needed https://opendata.arcgis.com/datasets/ee6d0642d2a04e35892d0eab77d971d6_2.kml data/input/sidewalks.kml;
|
2019-09-09 03:23:53 +03:00
|
|
|
|
|
|
|
cd kml
|
|
|
|
time cargo run --release -- \
|
2019-10-23 19:35:41 +03:00
|
|
|
--input=../data/input/sidewalks.kml \
|
2019-12-03 22:55:54 +03:00
|
|
|
--output=../data/input/sidewalks.bin
|
2019-12-04 06:28:58 +03:00
|
|
|
rm -f ../data/input/sidewalks.kml;
|
2019-09-09 03:23:53 +03:00
|
|
|
cd ..
|
|
|
|
fi
|
|
|
|
|
2019-08-25 04:41:28 +03:00
|
|
|
if [ ! -f data/input/offstreet_parking.kml ]; then
|
|
|
|
# From https://data.seattle.gov/Transportation/Public-Garages-or-Parking-Lots/xefx-khzm
|
|
|
|
get_if_needed http://data-seattlecitygis.opendata.arcgis.com/datasets/8e52dfde6d5d45948f7a90654c8d50cd_0.kml data/input/offstreet_parking.kml;
|
|
|
|
fi
|
|
|
|
|
2018-03-13 18:04:21 +03:00
|
|
|
cd convert_osm
|
2019-12-03 23:22:59 +03:00
|
|
|
for poly in `ls ../data/input/polygons/`; do
|
2018-10-31 01:00:32 +03:00
|
|
|
name=`basename -s .poly $poly`;
|
2019-07-02 17:43:28 +03:00
|
|
|
if [ "$only_map" != "" ] && [ "$only_map" != "$name" ]; then
|
|
|
|
continue;
|
|
|
|
fi
|
|
|
|
|
2019-12-03 23:22:59 +03:00
|
|
|
rm -rf ../data/input/neighborhoods/$name ../data/system/maps/${name}.bin;
|
2019-08-26 21:22:21 +03:00
|
|
|
RUST_BACKTRACE=1 cargo run $release -- \
|
2019-12-03 23:25:33 +03:00
|
|
|
--osm=../data/input/osm/$name.osm \
|
2019-12-03 22:55:54 +03:00
|
|
|
--parking_shapes=../data/input/blockface.bin \
|
2019-08-25 23:19:35 +03:00
|
|
|
--offstreet_parking=../data/input/offstreet_parking.kml \
|
2018-11-08 21:43:42 +03:00
|
|
|
--gtfs=../data/input/google_transit_2018_18_08 \
|
|
|
|
--neighborhoods=../data/input/neighborhoods.geojson \
|
2019-12-03 23:22:59 +03:00
|
|
|
--clip=../data/input/polygons/$name.poly \
|
2019-12-03 23:06:49 +03:00
|
|
|
--output=../data/input/raw_maps/$name.bin
|
2019-12-03 22:55:54 +03:00
|
|
|
#--sidewalks=../data/input/sidewalks.bin \
|
2018-10-30 01:12:45 +03:00
|
|
|
done
|