#!/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 2208.0 3324.0 26.647333333333332 57.37153333333333 -gcp 45102.0 3069.0 27.87815 57.39706666666667 -gcp 44982.0 33603.0 27.908883333333332 56.924366666666664 -gcp 2322.0 33762.0 26.69558333333333 56.89803333333333 1915_3verst_de_126k/loc/Reihe_VIII_Blatt_6_Marienhausen_1915_loc.jpg Reihe_VIII_Blatt_6_Marienhausen_1915_loc.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "2187.0 18585.023320377568\n2208.0 3324.0\n23695.5 3152.975846751805\n45102.0 3069.0\n45102.75 18357.011660188782\n44982.0 33603.0\n23619.0 33590.94919489173\n2322.0 33762.0" | \ gdaltransform -tps -output_xy Reihe_VIII_Blatt_6_Marienhausen_1915_loc.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Reihe_VIII_Blatt_6_Marienhausen_1915_loc.vrt Reihe_VIII_Blatt_6_Marienhausen_1915_loc.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Reihe_VIII_Blatt_6_Marienhausen_1915_loc.cut.vrt Reihe_VIII_Blatt_6_Marienhausen_1915_loc.xyz