#!/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 327.75 905.3072423398328 22.5 56.75 -gcp 12054.0 888.2686629526462 23 56.75 -gcp 12099.75 11559.825417827298 23 56.5 -gcp 322.5 11573.345055710306 22.5 56.5 25-Blidene_1938.jpg 25-Blidene_1938.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e \"327.75 905.3072423398328\n12054.0 888.2686629526462\n12099.75 11559.825417827298\n322.5 11573.345055710306\" | \ gdaltransform -tps -output_xy 25-Blidene_1938.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}'))))" \ 25-Blidene_1938.vrt 25-Blidene_1938.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES 25-Blidene_1938.cut.vrt 25-Blidene_1938.xyz