#!/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.380070854514 56.556648603483 -gcp 10698.0 0.0 21.380910164626 56.529293453976 -gcp 10698.0 12447.0 21.324001482958 56.528619205288 -gcp 0.0 12447.0 21.322620366626 56.55587379401 Aizpute-1988-991/Aizpute-1988-991-37.jpg Aizpute-1988-991-37.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "579.0 1242.0\n10440.0 1260.0\n10410.0 11184.0\n537.0 11148.0" | \ gdaltransform -tps -output_xy Aizpute-1988-991-37.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-37.vrt Aizpute-1988-991-37.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-37.cut.vrt Aizpute-1988-991-37.xyz