#!/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 825.0 1764.0 26.426666666666666 56.5 -gcp 13941.0 1872.0 26.576666666666668 56.5 -gcp 13842.0 14979.0 26.576666666666668 56.416666666666664 -gcp 774.0 14889.0 26.426666666666666 56.416666666666664 Gruppe_Dunaburg/VI-21-B.jpg VI-21-B.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "825.0 1764.0\n13941.0 1872.0\n13842.0 14979.0\n774.0 14889.0" | \ gdaltransform -tps -output_xy VI-21-B.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ VI-21-B.vrt VI-21-B.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES VI-21-B.cut.vrt VI-21-B.xyz