#!/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.471952199936 56.556038383056 -gcp 10542.0 0.0 21.472746133804 56.528903284966 -gcp 10542.0 12384.0 21.415985226631 56.528462456403 -gcp 0.0 12384.0 21.414595842361 56.555450046095 Aizpute-1988-991/Aizpute-1988-991-33.jpg Aizpute-1988-991-33.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "318.0 933.0\n337.5 10839.0\n10203.0 10822.5\n10179.0 898.5" | \ gdaltransform -tps -output_xy Aizpute-1988-991-33.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-33.vrt Aizpute-1988-991-33.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-33.cut.vrt Aizpute-1988-991-33.xyz