#!/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.567791395919 56.63655224209 -gcp 11112.0 0.0 21.563752749772 56.608439516767 -gcp 11112.0 12903.0 21.50440705361 56.61075479033 -gcp 0.0 12903.0 21.508579810208 56.639080008775 Aizpute-1988-991/Aizpute-1988-991-83.jpg Aizpute-1988-991-83.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "9.0 3591.0\n1.5 1618.5\n9618.0 657.0\n10587.0 10537.5\n760.5 11503.5" | \ gdaltransform -tps -output_xy Aizpute-1988-991-83.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-83.vrt Aizpute-1988-991-83.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-83.cut.vrt Aizpute-1988-991-83.xyz