#!/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.417546237546 56.576112996973 -gcp 11391.0 0.0 21.413665363725 56.546901598705 -gcp 11391.0 12168.0 21.357409917431 56.549298798509 -gcp 0.0 12168.0 21.361129858712 56.578350438318 Aizpute-1988-991/Aizpute-1988-991-49.jpg Aizpute-1988-991-49.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "196.5 2025.0\n10002.0 922.5\n11106.0 10765.5\n1266.0 11842.5" | \ gdaltransform -tps -output_xy Aizpute-1988-991-49.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-49.vrt Aizpute-1988-991-49.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-49.cut.vrt Aizpute-1988-991-49.xyz