#!/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 2388.0 2454.0 22.820666666666668 58.16635 -gcp 29901.0 2400.0 24.053533333333334 58.22678333333333 -gcp 29850.0 21711.0 24.1349 57.754 -gcp 2505.0 21903.0 22.913183333333333 57.69295 1915_3verst_de_126k/uw/Reihe_VI_Blatt_3_Runoe_1915_uw.jpg Reihe_VI_Blatt_3_Runoe_1915_uw.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "2388.0 2454.0\n29901.0 2400.0\n29850.0 21711.0\n2505.0 21903.0" | \ gdaltransform -tps -output_xy Reihe_VI_Blatt_3_Runoe_1915_uw.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Reihe_VI_Blatt_3_Runoe_1915_uw.vrt Reihe_VI_Blatt_3_Runoe_1915_uw.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Reihe_VI_Blatt_3_Runoe_1915_uw.cut.vrt Reihe_VI_Blatt_3_Runoe_1915_uw.xyz