#!/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 3999.0 2829.0 21.337216666666666 57.75 -gcp 25074.0 2919.0 21.837216666666666 57.75 -gcp 24942.0 23595.0 21.837216666666666 57.5 -gcp 3810.0 22584.0 21.337216666666666 57.5 nr/KdwR-LC_J11_Lyserort_1918_.jpg KdwR-LC_J11_Lyserort_1918_.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "3999.0 2829.0\n25074.0 2919.0\n25146.0 19781.98665925514\n25134.0 21239.749861033906\n24942.0 23595.0\n14364.0 23003.953307392996\n3810.0 22584.0" | \ gdaltransform -tps -output_xy KdwR-LC_J11_Lyserort_1918_.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ KdwR-LC_J11_Lyserort_1918_.vrt KdwR-LC_J11_Lyserort_1918_.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES KdwR-LC_J11_Lyserort_1918_.cut.vrt KdwR-LC_J11_Lyserort_1918_.xyz