#!/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.390101909637 56.617863233121 -gcp 10350.0 0.0 21.392794847488 56.591372077818 -gcp 10350.0 12174.0 21.336801052094 56.589410781304 -gcp 0.0 12174.0 21.333485841751 56.615932834406 Aizpute-1988-991/Aizpute-1988-991-75.jpg Aizpute-1988-991-75.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "24.0 4902.0\n135.0 597.0\n9978.0 828.0\n9747.0 10743.0\n6.0 10488.0" | \ gdaltransform -tps -output_xy Aizpute-1988-991-75.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-75.vrt Aizpute-1988-991-75.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-75.cut.vrt Aizpute-1988-991-75.xyz