#!/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 807.0 972.0 22.5 58 -gcp 11193.0 1005.0 24 58 -gcp 11307.0 14133.0 24 57 -gcp 633.0 14097.0 22.5 57 32_Talsi_1940.jpg 32_Talsi_1940.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e \"807.0 972.0\n633.0 14095.876041088282\n11310.0 14133.0\n11196.0 1005.0\" | \ gdaltransform -tps -output_xy 32_Talsi_1940.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}'))))" \ 32_Talsi_1940.vrt 32_Talsi_1940.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES 32_Talsi_1940.cut.vrt 32_Talsi_1940.xyz