#!/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 2103.0 2553.0 27.96998333333333 55.976483333333334 -gcp 29337.0 2508.0 29.14655 55.99118333333333 -gcp 29349.0 22293.0 29.15895 55.52043333333334 -gcp 2064.0 22302.0 28.0002 55.501216666666664 1915_3verst_de_126k/uw/Reihe_XI_Blatt_7_Dissna_1915_uw.jpg Reihe_XI_Blatt_7_Dissna_1915_uw.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "2058.0 12437.255413659077\n2103.0 2553.0\n29337.0 2508.0\n29328.0 12417.759578012217\n29349.0 22293.0\n15684.0 22282.491671293727\n2064.0 22302.0" | \ gdaltransform -tps -output_xy Reihe_XI_Blatt_7_Dissna_1915_uw.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Reihe_XI_Blatt_7_Dissna_1915_uw.vrt Reihe_XI_Blatt_7_Dissna_1915_uw.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Reihe_XI_Blatt_7_Dissna_1915_uw.cut.vrt Reihe_XI_Blatt_7_Dissna_1915_uw.xyz