#!/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 2139.0 2334.0 25.6084 55.9133 -gcp 29490.0 2355.0 26.789983333333332 55.94805 -gcp 29427.0 22068.0 26.836 55.47593333333333 -gcp 2064.0 22053.0 25.666816666666666 55.43803333333334 1915_3verst_de_126k/greif/Reihe_XI_Blatt_5_Duenaburg_1914_greif.jpg Reihe_XI_Blatt_5_Duenaburg_1914_greif.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "2139.0 2334.0\n15811.5 2300.975846751805\n29490.0 2355.0\n29451.0 12225.007495835647\n29427.0 22068.0\n15742.5 22052.995835646863\n2064.0 22053.0" | \ gdaltransform -tps -output_xy Reihe_XI_Blatt_5_Duenaburg_1914_greif.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Reihe_XI_Blatt_5_Duenaburg_1914_greif.vrt Reihe_XI_Blatt_5_Duenaburg_1914_greif.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Reihe_XI_Blatt_5_Duenaburg_1914_greif.cut.vrt Reihe_XI_Blatt_5_Duenaburg_1914_greif.xyz