make setup more user friendly
This commit is contained in:
parent
fa281bfc8a
commit
faebb2692f
1 changed files with 46 additions and 25 deletions
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
clear
|
||||
DATE_UTC=$(date -u +"%d%m%y")
|
||||
|
@ -6,34 +6,55 @@ REGION=us
|
|||
REGION_DATA=$REGION-$DATE_UTC.osm.pbf
|
||||
REGION_TILES=$REGION.mbtiles
|
||||
|
||||
echo "Setup
|
||||
======================
|
||||
1. Just install/update martin
|
||||
2. Install/update martin and generate US tiles (takes a long time and A LOT of RAM)
|
||||
|
||||
cd ./build
|
||||
Enter number [1-2]: "
|
||||
|
||||
read -r input
|
||||
|
||||
if ! [ "$input" -eq "$input" ] 2> /dev/null; then
|
||||
|
||||
echo "Error: Not a number"
|
||||
exit 1
|
||||
|
||||
elif [ "$input" -lt 1 ] || [ "$input" -gt 2 ]; then
|
||||
|
||||
echo "Error: Input out of range"
|
||||
exit 1
|
||||
|
||||
fi
|
||||
|
||||
# Martin
|
||||
if [ "$input" -ge 1 ]; then
|
||||
mkdir dist
|
||||
cd dist || exit 1
|
||||
echo Downloading and extracting martin...
|
||||
wget -c https://github.com/maplibre/martin/releases/latest/download/martin-x86_64-unknown-linux-gnu.tar.gz &&
|
||||
tar -xzvf martin-x86_64-unknown-linux-gnu.tar.gz
|
||||
cd ../
|
||||
fi
|
||||
|
||||
# Tiles
|
||||
if [ "$input" -ge 2 ]; then
|
||||
mkdir build
|
||||
cd ./build || exit 1
|
||||
if [ ! -f "./data/$REGION_DATA" ]; then
|
||||
echo Downloading OSM data...
|
||||
wget -cO ./data/$REGION_DATA https://download.geofabrik.de/north-america/$REGION-latest.osm.pbf
|
||||
wget -cO ./data/"$REGION_DATA" https://download.geofabrik.de/north-america/"$REGION"-latest.osm.pbf
|
||||
else
|
||||
echo $REGION_DATA already exists
|
||||
echo "$REGION_DATA" already exists
|
||||
fi
|
||||
if [ ! -f "../dist/data/$REGION_TILES" ]; then
|
||||
echo Creating $REGION_TILES...
|
||||
echo Creating "$REGION_TILES"...
|
||||
tilemaker \
|
||||
--input ./data/$REGION_DATA \
|
||||
--output ../dist/data/$REGION.mbtiles \
|
||||
--input ./data/"$REGION_DATA" \
|
||||
--output ../dist/data/"$REGION".mbtiles \
|
||||
--process ./resources/process-openmaptiles.lua \
|
||||
--config ./resources/config-openmaptiles.json
|
||||
else
|
||||
echo tiles already exist
|
||||
fi
|
||||
|
||||
|
||||
cd ../dist
|
||||
if [ ! -f martin ]; then
|
||||
echo Downloading and extracting martin...
|
||||
wget -c https://github.com/maplibre/martin/releases/latest/download/martin-x86_64-unknown-linux-gnu.tar.gz &&
|
||||
tar -xzvf martin-x86_64-unknown-linux-gnu.tar.gz
|
||||
else
|
||||
echo martin already exists
|
||||
fi
|
||||
|
||||
|
||||
echo done!
|
||||
|
|
Loading…
Add table
Reference in a new issue