#!/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 1608.0 2430.0 24.476666666666667 57.083333333333336 -gcp 14499.0 2373.0 24.626666666666665 57.083333333333336 -gcp 14556.0 15444.0 24.626666666666665 57 -gcp 1692.0 15555.0 24.476666666666667 57 132_Henselhoff_30.11.17.jpg 132_Henselhoff_30.11.17.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "1608.0 2430.0\n14499.0 2373.0\n14556.0 15444.0\n1692.0 15555.0" | \ gdaltransform -tps -output_xy 132_Henselhoff_30.11.17.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ 132_Henselhoff_30.11.17.vrt 132_Henselhoff_30.11.17.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES 132_Henselhoff_30.11.17.cut.vrt 132_Henselhoff_30.11.17.xyz