#!/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 2298.0 3570.0 27.908883333333332 56.924366666666664 -gcp 43545.0 3360.0 29.11703333333333 56.9402 -gcp 43704.0 32955.0 29.1317 56.465333333333334 -gcp 2454.0 33243.0 27.939783333333335 56.44968333333333 1915_3verst_de_126k/loc/Reihe_IX_Blatt_7_Opotschka_1915_loc.jpg Reihe_IX_Blatt_7_Opotschka_1915_loc.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "2298.0 3570.0\n22905.0 3436.4841754580793\n43545.0 3360.0\n43581.0 18184.514991671294\n43704.0 32955.0\n2454.0 33243.0" | \ gdaltransform -tps -output_xy Reihe_IX_Blatt_7_Opotschka_1915_loc.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Reihe_IX_Blatt_7_Opotschka_1915_loc.vrt Reihe_IX_Blatt_7_Opotschka_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_7_Opotschka_1915_loc.cut.vrt Reihe_IX_Blatt_7_Opotschka_1915_loc.xyz