#!/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 26.78209969582595 57.35004636643671 -gcp 14340.0 0.0 27.120228724913254 57.35222532267358 -gcp 14340.0 16308.0 27.122705981259383 57.14493383299559 -gcp 0.0 16308.0 26.786842072739212 57.14333171323902 227-Stamere_1924.jpg 227-Stamere_1924.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e \"7183.3125 1393.4989589117158\n1878.375 1331.9983342587452\n1794.75 7904.625\n1726.125 14477.626457523598\n7075.125 14520.37229317046\n12393.375 14572.499167129372\n12487.125 1458.7487506940588\" | \ gdaltransform -tps -output_xy 227-Stamere_1924.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}'))))" \ 227-Stamere_1924.vrt 227-Stamere_1924.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES 227-Stamere_1924.cut.vrt 227-Stamere_1924.xyz