#!/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 906.0 1275.0 18 60 -gcp 12753.0 1287.0 21 60 -gcp 13080.0 17094.0 21 58 -gcp 507.0 17049.0 18 58 RKKA500_O-34-A_Stokgol`m_1941_greif.jpg RKKA500_O-34-A_Stokgol`m_1941_greif.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "906.0 1275.0\n6825.75 1347.0366870483601\n12753.0 1287.0\n13080.0 17094.0\n6790.5 17128.531684269037\n507.0 17049.0" | \ gdaltransform -tps -output_xy RKKA500_O-34-A_Stokgol`m_1941_greif.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ RKKA500_O-34-A_Stokgol`m_1941_greif.vrt RKKA500_O-34-A_Stokgol`m_1941_greif.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES RKKA500_O-34-A_Stokgol`m_1941_greif.cut.vrt RKKA500_O-34-A_Stokgol`m_1941_greif.xyz