#!/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.310962898323748 56.53764824000422 -gcp 11457.0 0.0 21.31551974351328 56.508514316196724 -gcp 11457.0 12915.0 21.2560937259403 56.505583296593 -gcp 0.0 12915.0 21.251349126119816 56.53479696601331 Aizpute-1988-991/Aizpute-1988-991-17.jpg Aizpute-1988-991-17.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "1140.0 1057.5\n598.5 10927.5\n10489.5 11449.5\n10995.0 1576.5" | \ gdaltransform -tps -output_xy Aizpute-1988-991-17.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-17.vrt Aizpute-1988-991-17.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-17.cut.vrt Aizpute-1988-991-17.xyz