#!/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 27.036061166055923 56.85193147431126 -gcp 14340.0 0.0 27.369503570166827 56.85213645635952 -gcp 14340.0 16344.0 27.367558598423262 56.64439157024601 -gcp 0.0 16344.0 27.035957692210843 56.64466766780728 242-Struzani_1925.jpg 242-Struzani_1925.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e \"7130.25 1456.4950027762354\n1750.5 1460.6247917823432\n1749.375 8034.376873958912\n1762.125 14601.747084952804\n7167.0 14590.87250138812\n12569.25 14589.0\n12544.5 8034.3777068295385\n12508.5 1470.373542476402\" | \ gdaltransform -tps -output_xy 242-Struzani_1925.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}'))))" \ 242-Struzani_1925.vrt 242-Struzani_1925.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES 242-Struzani_1925.cut.vrt 242-Struzani_1925.xyz