#!/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.402306327027 56.555920947835 -gcp 10518.0 0.0 21.402973838215 56.529084596371 -gcp 10518.0 12381.0 21.346231955134 56.528527254625 -gcp 0.0 12381.0 21.345441062331 56.555331075704 Aizpute-1988-991/Aizpute-1988-991-36.jpg Aizpute-1988-991-36.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "292.5 1105.5\n10158.0 927.0\n10324.5 10861.5\n450.0 11017.5" | \ gdaltransform -tps -output_xy Aizpute-1988-991-36.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-36.vrt Aizpute-1988-991-36.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-36.cut.vrt Aizpute-1988-991-36.xyz