#!/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.264245108052 56.556311039771 -gcp 10722.0 0.0 21.263233423233 56.528669559686 -gcp 10722.0 12558.0 21.205240018035 56.529202802137 -gcp 0.0 12558.0 21.205898523331 56.556700580146 Aizpute-1988-991/Aizpute-1988-991-42.jpg Aizpute-1988-991-42.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "330.0 1251.0\n10192.5 804.0\n10629.0 10726.5\n763.5 11154.0" | \ gdaltransform -tps -output_xy Aizpute-1988-991-42.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-42.vrt Aizpute-1988-991-42.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-42.cut.vrt Aizpute-1988-991-42.xyz