maps/marteen/setup

62 lines
1.6 KiB
Text
Raw Normal View History

2024-01-27 15:20:26 -05:00
#!/bin/sh
2023-04-18 23:54:59 -04:00
clear
DATE_UTC=$(date -u +"%d%m%y")
2023-04-25 19:18:51 -04:00
REGION=us
2023-04-18 23:54:59 -04:00
REGION_DATA=$REGION-$DATE_UTC.osm.pbf
REGION_TILES=$REGION.mbtiles
2024-01-27 15:20:26 -05:00
echo "Setup
======================
1. Just install/update martin
2. Install/update martin and generate US tiles (takes a long time and A LOT of RAM)
2023-04-18 23:54:59 -04:00
2024-01-27 15:20:26 -05:00
Enter number [1-2]: "
read -r input
if ! [ "$input" -eq "$input" ] 2> /dev/null; then
echo "Error: Not a number"
exit 1
2023-04-18 23:54:59 -04:00
2024-01-27 15:20:26 -05:00
elif [ "$input" -lt 1 ] || [ "$input" -gt 2 ]; then
2023-04-18 23:54:59 -04:00
2024-01-27 15:20:26 -05:00
echo "Error: Input out of range"
exit 1
fi
# Martin
if [ "$input" -ge 1 ]; then
mkdir dist
cd dist || exit 1
2023-04-18 23:54:59 -04:00
echo Downloading and extracting martin...
2024-02-23 20:14:22 -05:00
rm martin-x86_64-unknown-linux-gnu.tar.gz martin martin-cp mbtiles
2023-12-16 21:38:26 -05:00
wget -c https://github.com/maplibre/martin/releases/latest/download/martin-x86_64-unknown-linux-gnu.tar.gz &&
2024-01-27 15:20:26 -05:00
tar -xzvf martin-x86_64-unknown-linux-gnu.tar.gz
cd ../
2023-04-18 23:54:59 -04:00
fi
2024-01-27 15:20:26 -05:00
# 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
else
echo "$REGION_DATA" already exists
fi
if [ ! -f "../dist/data/$REGION_TILES" ]; then
echo Creating "$REGION_TILES"...
tilemaker \
--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
fi