#!/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 0.0 0.0 21.591010093689 56.596833039248 -gcp 10716.0 0.0 21.591793298721 56.569809937912 -gcp 10716.0 12516.0 21.534858351847 56.569089455519 -gcp 0.0 12516.0 21.533895134926 56.596215807775 Aizpute-1988-991/Aizpute-1988-991-56.jpg Aizpute-1988-991-56.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "519.0 1182.0\n10377.0 1176.0\n10374.0 11061.0\n529.5 11050.5" | \ gdaltransform -tps -output_xy Aizpute-1988-991-56.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-56.vrt Aizpute-1988-991-56.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-56.cut.vrt Aizpute-1988-991-56.xyz