#!/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 3468.0 3627.0 24.295066666666667 56.80938333333334 -gcp 44316.0 3303.0 25.490083333333335 56.85845 -gcp 44442.0 32949.0 25.549733333333332 56.38473333333334 -gcp 3687.0 33219.0 24.373166666666666 56.33838333333333 1915_3verst_de_126k/loc/Reihe_IX_Blatt_4_Friedrichstadt_1915_loc.jpg Reihe_IX_Blatt_4_Friedrichstadt_1915_loc.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "3468.0 3627.0\n23892.0 3443.237923375902\n44316.0 3303.0\n44373.0 18130.50249861188\n44442.0 32949.0\n24069.0 33020.96501943365\n3687.0 33219.0" | \ gdaltransform -tps -output_xy Reihe_IX_Blatt_4_Friedrichstadt_1915_loc.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Reihe_IX_Blatt_4_Friedrichstadt_1915_loc.vrt Reihe_IX_Blatt_4_Friedrichstadt_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_4_Friedrichstadt_1915_loc.cut.vrt Reihe_IX_Blatt_4_Friedrichstadt_1915_loc.xyz