#!/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 480.0 906.0 25.5 58 -gcp 10884.0 891.0 27 58 -gcp 11082.0 14004.0 27 57 -gcp 390.0 14052.0 25.5 57 34_Valka_1935.jpg 34_Valka_1935.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e \"480.0 906.0\n392.25 14053.12562465297\n11085.0 14004.0\n10885.5 890.6247917823432\" | \ gdaltransform -tps -output_xy 34_Valka_1935.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}'))))" \ 34_Valka_1935.vrt 34_Valka_1935.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES 34_Valka_1935.cut.vrt 34_Valka_1935.xyz