Recipe
# You need a recent curl version. Hence, my path points to a compiler curl version
# The goal is to manage when new MAJ should be done instead of running full processing for nothing
curl_path=/home/thomasg/curl/bin/curl
mydate=$($curl_path -Ls -o /dev/null --head -w "%header{last-modified}" https://planet.openstreetmap.org/pbf/planet-latest.osm.pbf)
current_date=$(date -d "$mydate" +"%Y-%m-%dT%H:%M:%S%:z")
function install_deps {
sudo apt install --yes build-essential libboost-dev libboost-filesystem-dev libboost-iostreams-dev libboost-program-options-dev libboost-system-dev liblua5.1-0-dev libshp-dev libsqlite3-dev rapidjson-dev lua5.4 liblua5.4-dev zlib1g-dev git unzip htop wget
}
install_deps
if [ ! -f iso-last-call.txt ]; then
echo $current_date >| iso-last-call.txt
generate_tiles
fi
if [ -f iso-last-call.txt ]; then
difference_length=$(diff iso-last-call.txt <(echo $current_date) | wc -l)
if (( $difference_length > 0 ));
generate_tiles
fi
fi
function get_external_ressources {
if [ -d coastline ]; then
rm -rf coastline
fi
if [ -d landcover ]; then
rm -rf landcover
fi
wget https://osmdata.openstreetmap.de/download/water-polygons-split-4326.zip
unzip water-polygons-split-4326.zip
mv water-polygons-split-4326 coastline
rm water-polygons-split-4326.zip
wget https://naciscdn.org/naturalearth/10m/cultural/ne_10m_urban_areas.zip
wget https://naciscdn.org/naturalearth/10m/physical/ne_10m_antarctic_ice_shelves_polys.zip
wget https://naciscdn.org/naturalearth/10m/physical/ne_10m_glaciated_areas.zip
mkdir -p landcover
for i in ne_*.zip;
do dir_target="${i%.*}";
unzip -d landcover/$dir_target/ $i;
done;
}
function generate_tiles {
if [ -d tilemaker ];
then cd tilemaker;
make clean;
git pull;
else
git clone https://github.com/systemed/tilemaker.git;
fi
make
sudo make install
get_external_ressources
if [ -f planet-latest.osm.pbf ]; then
rm planet-latest.osm.pbf;
fi
if [ -f planet.mbtiles ]; then
rm planet.mbtiles;
fi
wget https://planet.openstreetmap.org/pbf/planet-latest.osm.pbf
nohup tilemaker --input planet-latest.osm.pbf \
--output planet.mbtiles \
--config resources/config-openmaptiles.json \
--process resources/process-openmaptiles.lua \
--store /home/debian/tilemaker-cache &
}