#!/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.308717798906 56.557219409126 -gcp 10770.0 0.0 21.310627244348 56.529680279321 -gcp 10770.0 12450.0 21.253348344385 56.528342603553 -gcp 0.0 12450.0 21.25120286455 56.555991288178 Aizpute-1988-991/Aizpute-1988-991-40.jpg Aizpute-1988-991-40.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "738.0 912.0\n10599.0 1101.0\n10407.0 11025.0\n547.5 10825.5" | \ gdaltransform -tps -output_xy Aizpute-1988-991-40.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-40.vrt Aizpute-1988-991-40.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-40.cut.vrt Aizpute-1988-991-40.xyz