#!/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 1073.25 1488.0376044568245 25 57.5 -gcp 13569.75 1488.8310584958217 25.5 57.5 -gcp 13622.25 13058.387465181058 25.5 57.25 -gcp 1044.0 13059.222284122563 25 57.25 55-Cesis_1931.jpg 55-Cesis_1931.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e \"1073.25 1488.0376044568245\n13569.75 1488.8310584958217\n13622.25 13058.387465181058\n1044.0 13059.222284122563\" | \ gdaltransform -tps -output_xy 55-Cesis_1931.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}'))))" \ 55-Cesis_1931.vrt 55-Cesis_1931.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES 55-Cesis_1931.cut.vrt 55-Cesis_1931.xyz