#!/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 2154.0 1974.0 23.093783333333334 56.74915 -gcp 29409.0 1959.0 24.295066666666667 56.80938333333334 -gcp 29430.0 21705.0 24.373166666666666 56.33838333333333 -gcp 2187.0 21777.0 23.18235 56.2773 1915_3verst_de_126k/greif/Reihe_IX_Blatt_3_Mitau_1914_greif.jpg Reihe_IX_Blatt_3_Mitau_1914_greif.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "2178.0 11898.012493059412\n2154.0 1974.0\n15783.75 1979.2570794003332\n29409.0 1959.0\n29430.0 21705.0\n2187.0 21777.0" | \ gdaltransform -tps -output_xy Reihe_IX_Blatt_3_Mitau_1914_greif.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Reihe_IX_Blatt_3_Mitau_1914_greif.vrt Reihe_IX_Blatt_3_Mitau_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_3_Mitau_1914_greif.cut.vrt Reihe_IX_Blatt_3_Mitau_1914_greif.xyz