#!/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 588.0 1254.0 25.076666666666668 56.75 -gcp 9285.0 1458.0 25.226666666666667 56.75 -gcp 9090.0 10200.0 25.226666666666667 56.666666666666664 -gcp 342.0 10029.0 25.076666666666668 56.666666666666664 071_Belten_3.9.17.jpg 071_Belten_3.9.17.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "588.0 1254.0\n9285.0 1458.0\n9090.0 10200.0\n342.0 10029.0" | \ gdaltransform -tps -output_xy 071_Belten_3.9.17.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ 071_Belten_3.9.17.vrt 071_Belten_3.9.17.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES 071_Belten_3.9.17.cut.vrt 071_Belten_3.9.17.xyz