#!/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 1134.0 822.0 25.976666666666667 57.75 -gcp 6393.0 852.0 26.126666666666665 57.75 -gcp 6363.0 6273.0 26.126666666666665 57.666666666666664 -gcp 1098.0 6240.0 25.976666666666667 57.666666666666664 Gruppe_Dunaburg/I-20-B.jpg I-20-B.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "1134.0 822.0\n6393.0 852.0\n6363.0 6273.0\n1098.0 6240.0" | \ gdaltransform -tps -output_xy I-20-B.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ I-20-B.vrt I-20-B.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES I-20-B.cut.vrt I-20-B.xyz