#!/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 1857.0 1980.0 24.326666666666668 57.25 -gcp 10389.0 1881.0 24.476666666666667 57.25 -gcp 10497.0 10659.0 24.476666666666667 57.166666666666664 -gcp 1944.0 10743.0 24.326666666666668 57.166666666666664 150_Pabbasch_1.9.16.jpg 150_Pabbasch_1.9.16.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "1857.0 1980.0\n10389.0 1881.0\n10497.0 10659.0\n1944.0 10743.0" | \ gdaltransform -tps -output_xy 150_Pabbasch_1.9.16.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ 150_Pabbasch_1.9.16.vrt 150_Pabbasch_1.9.16.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES 150_Pabbasch_1.9.16.cut.vrt 150_Pabbasch_1.9.16.xyz