maps.chandlerswift.com/layers/minnesota-adventure-trails/get_data.sh

29 lines
791 B
Bash
Executable file

#!/bin/sh
# SEMAT: https://www.google.com/maps/d/u/0/viewer?mid=1fd5DwCNSTNyd2ijSa3FcKTXfn85wFD8
# NEMAT: https://www.google.com/maps/d/u/0/viewer?mid=19EWOYHcIlO9HX3Xwc6peFxMwdhsEt78
# NCMAT: https://www.google.com/maps/d/u/0/viewer?mid=1qtnoqH2w_E4QT8rDYStKw_S1TWI-cRw
cd $(dirname $0)
for file in *.kmz; do
zcat "$file" | ogr2ogr -f GeoJSON "$(basename "$file" .kmz).geojson" /vsistdin/ -skipfailures
done
# hack hack hack
truncate -s 0 routes.js
i=0
for file in ./*.geojson; do
echo "import _file$i from '$file?url';" >> routes.js
i=$((i+1))
done
echo >> routes.js
echo "export default {" >> routes.js
i=0
for file in ./*.geojson; do
basename=$(basename "$file" .geojson)
echo " \"$basename\": _file$i," >> routes.js
i=$((i+1))
done
echo "};" >> routes.js