#!/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.544539727054 56.659650580892 -gcp 11562.0 0.0 21.538637630449 56.630375403858 -gcp 11562.0 13029.0 21.479026543383 56.633992424659 -gcp 0.0 13029.0 21.484724792103 56.663223301783 Aizpute-1988-991/Aizpute-1988-991-108.jpg Aizpute-1988-991-108.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "366.0 1782.0\n10131.0 583.5\n11346.0 10408.5\n1539.0 11605.5" | \ gdaltransform -tps -output_xy Aizpute-1988-991-108.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-108.vrt Aizpute-1988-991-108.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-108.cut.vrt Aizpute-1988-991-108.xyz