#!/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 735.0 1455.0 21 60 -gcp 12573.0 1257.0 24 60 -gcp 13182.0 17037.0 24 58 -gcp 651.0 17232.0 21 58 RKKA500_O-34-B_Xapsalu_1941_greif.jpg RKKA500_O-34-B_Xapsalu_1941_greif.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "735.0 1455.0\n6637.5 1401.0250138966092\n12573.0 1257.0\n13182.0 17037.0\n6919.5 17194.53335186215\n651.0 17232.0" | \ gdaltransform -tps -output_xy RKKA500_O-34-B_Xapsalu_1941_greif.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ RKKA500_O-34-B_Xapsalu_1941_greif.vrt RKKA500_O-34-B_Xapsalu_1941_greif.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES RKKA500_O-34-B_Xapsalu_1941_greif.cut.vrt RKKA500_O-34-B_Xapsalu_1941_greif.xyz