#!/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 2130.0 2385.0 21.898233333333334 56.677033333333334 -gcp 29610.0 2370.0 23.093783333333334 56.74915 -gcp 29544.0 22131.0 23.18235 56.2773 -gcp 2109.0 22170.0 22.0042 56.20791666666667 1915_3verst_de_126k/greif/Reihe_IX_Blatt_2_Laishew_1914_greif.jpg Reihe_IX_Blatt_2_Laishew_1914_greif.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "2130.0 2385.0\n15858.75 2364.742920599667\n29610.0 2370.0\n29595.0 12280.516657412549\n29544.0 22131.0\n15813.75 22145.99750138812\n2109.0 22170.0" | \ gdaltransform -tps -output_xy Reihe_IX_Blatt_2_Laishew_1914_greif.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Reihe_IX_Blatt_2_Laishew_1914_greif.vrt Reihe_IX_Blatt_2_Laishew_1914_greif.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_1914_greif.cut.vrt Reihe_IX_Blatt_2_Laishew_1914_greif.xyz