2018-03-13 18:04:21 +03:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
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
|
|
|
|
wget $1 -O $2;
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2018-10-20 05:20:42 +03:00
|
|
|
mkdir -p data/input data/raw_maps
|
2018-10-04 08:26:56 +03:00
|
|
|
|
|
|
|
# TODO refactor a variant for .zips?
|
|
|
|
if [ ! -f data/input/N47W122.hgt ]; then
|
2018-11-08 21:43:42 +03:00
|
|
|
get_if_needed \
|
|
|
|
https://dds.cr.usgs.gov/srtm/version2_1/SRTM1/Region_01/N47W122.hgt.zip \
|
|
|
|
data/input/N47W122.hgt.zip;
|
2018-10-04 08:26:56 +03:00
|
|
|
unzip -d data/input data/input/N47W122.hgt.zip;
|
|
|
|
rm -f data/input/N47W122.hgt.zip;
|
|
|
|
fi
|
|
|
|
|
|
|
|
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-11-27 23:40:03 +03:00
|
|
|
if [ ! -f data/input/traffic_signals.kml ]; then
|
|
|
|
# From https://data.seattle.gov/Transportation/Traffic-Signals/nr6x-wnd5
|
2018-11-08 21:43:42 +03:00
|
|
|
get_if_needed \
|
2018-11-27 23:40:03 +03:00
|
|
|
http://data-seattlecitygis.opendata.arcgis.com/datasets/ff97a6eb8ac84356beea09138c6e1ec3_0.kml \
|
|
|
|
data/input/traffic_signals.kml;
|
2018-10-04 08:26:56 +03:00
|
|
|
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
|
|
|
|
|
2018-10-04 08:26:56 +03:00
|
|
|
if [ ! -f data/input/Seattle.osm ]; then
|
2018-11-08 21:43:42 +03:00
|
|
|
get_if_needed \
|
|
|
|
http://download.bbbike.org/osm/bbbike/Seattle/Seattle.osm.gz \
|
|
|
|
data/input/Seattle.osm.gz;
|
2018-10-04 08:26:56 +03:00
|
|
|
gunzip data/input/Seattle.osm.gz;
|
|
|
|
fi
|
|
|
|
|
2018-10-30 01:12:45 +03:00
|
|
|
for poly in `ls data/polygons/`; do
|
|
|
|
name=`basename -s .poly $poly`;
|
|
|
|
if [ ! -f data/input/$name.osm ]; then
|
2018-11-08 21:43:42 +03:00
|
|
|
osmosis \
|
|
|
|
--read-xml enableDateParsing=no file=data/input/Seattle.osm \
|
|
|
|
--bounding-polygon file=data/polygons/$name.poly completeWays=true \
|
|
|
|
--write-xml data/input/$name.osm
|
2018-10-30 01:12:45 +03:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2018-11-21 23:26:23 +03:00
|
|
|
if [ ! -f data/shapes/parcels ]; then
|
|
|
|
# From https://gis-kingcounty.opendata.arcgis.com/datasets/king-county-parcels--parcel-area/geoservice
|
2019-01-11 07:56:15 +03:00
|
|
|
get_if_needed https://opendata.arcgis.com/datasets/8058a0c540434dadbe3ea0ade6565143_439.kml data/input/King_County_Parcels__parcel_area.kml;
|
2018-11-21 23:26:23 +03:00
|
|
|
|
2018-04-11 03:38:26 +03:00
|
|
|
cd kml
|
2018-11-21 23:26:23 +03:00
|
|
|
time cargo run --release -- \
|
|
|
|
--input=../data/input/King_County_Parcels__parcel_area.kml \
|
|
|
|
--output=../data/shapes/parcels
|
2018-04-11 03:38:26 +03:00
|
|
|
cd ..
|
2018-03-13 18:04:21 +03:00
|
|
|
fi
|
|
|
|
|
2018-11-22 04:18:31 +03:00
|
|
|
if [ ! -f data/shapes/blockface ]; then
|
|
|
|
# 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 \
|
|
|
|
--output=../data/shapes/blockface
|
|
|
|
cd ..
|
|
|
|
fi
|
|
|
|
|
2018-03-13 18:04:21 +03:00
|
|
|
cd convert_osm
|
2018-10-31 01:00:32 +03:00
|
|
|
for poly in `ls ../data/polygons/`; do
|
|
|
|
name=`basename -s .poly $poly`;
|
2018-11-08 21:43:42 +03:00
|
|
|
cargo run --release -- \
|
|
|
|
--osm=../data/input/$name.osm \
|
|
|
|
--elevation=../data/input/N47W122.hgt \
|
2018-11-27 23:40:03 +03:00
|
|
|
--traffic_signals=../data/input/traffic_signals.kml \
|
2018-11-21 23:26:23 +03:00
|
|
|
--parcels=../data/shapes/parcels \
|
2018-11-22 04:18:31 +03:00
|
|
|
--parking_shapes=../data/shapes/blockface \
|
2018-11-08 21:43:42 +03:00
|
|
|
--gtfs=../data/input/google_transit_2018_18_08 \
|
|
|
|
--neighborhoods=../data/input/neighborhoods.geojson \
|
|
|
|
--output=../data/raw_maps/$name.abst
|
2018-10-30 01:12:45 +03:00
|
|
|
done
|
2019-01-17 00:43:16 +03:00
|
|
|
|
|
|
|
# To run manually: cargo run -- --osm=../data/input/montlake.osm --elevation=../data/input/N47W122.hgt --traffic_signals=../data/input/traffic_signals.kml --parcels=../data/shapes/parcels --parking_shapes=../data/shapes/blockface --gtfs=../data/input/google_transit_2018_18_08 --neighborhoods=../data/input/neighborhoods.geojson --output=../data/raw_maps/montlake.abst --fast_dev
|