#!/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 2334.0 2469.0 26.743133333333333 56.423116666666665 -gcp 29757.0 2496.0 27.939783333333335 56.44968333333333 -gcp 29970.0 22245.0 27.96998333333333 55.976483333333334 -gcp 2265.0 21954.0 26.789983333333332 55.94805 1915_3verst_de_126k/uw/Reihe_X_Blatt_6_Dagda_1915_uw.jpg Reihe_X_Blatt_6_Dagda_1915_uw.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "2334.0 2469.0\n29757.0 2496.0\n29970.0 22245.0\n2265.0 21954.0" | \ gdaltransform -tps -output_xy Reihe_X_Blatt_6_Dagda_1915_uw.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Reihe_X_Blatt_6_Dagda_1915_uw.vrt Reihe_X_Blatt_6_Dagda_1915_uw.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Reihe_X_Blatt_6_Dagda_1915_uw.cut.vrt Reihe_X_Blatt_6_Dagda_1915_uw.xyz