#!/bin/bash GDAL_TILE_PROCESSES=16 GDAL_TILE_ZOOMS=8-14 GDAL_SAMPLING_WARP=cubic GDAL_SAMPLING_TILE=antialias # Create virtual dataset with coordinates gdal_translate -of VRT -a_srs EPSG:4326 -outsize 300% 300% -gcp 3117.0 3483.0 21.898233333333334 56.677033333333334 -gcp 44454.0 3309.0 23.093783333333334 56.74915 -gcp 44577.0 32946.0 23.18235 56.2773 -gcp 3324.0 33132.0 22.0042 56.20791666666667 1915_3verst_de_126k/loc/Reihe_IX_Blatt_2_Laishew_1915_loc.jpg Reihe_IX_Blatt_2_Laishew_1915_loc.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "3204.0 18315.754580788453\n3117.0 3483.0\n23785.5 3344.9716823986673\n44454.0 3309.0\n44577.0 32946.0\n23950.5 32998.47751249306\n3324.0 33132.0" | \ gdaltransform -tps -output_xy Reihe_IX_Blatt_2_Laishew_1915_loc.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Reihe_IX_Blatt_2_Laishew_1915_loc.vrt Reihe_IX_Blatt_2_Laishew_1915_loc.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Reihe_IX_Blatt_2_Laishew_1915_loc.cut.vrt Reihe_IX_Blatt_2_Laishew_1915_loc.xyz