#!/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 21.35464270024239 56.539429583472106 -gcp 12396.0 0.0 21.364561334982916 56.50864359390039 -gcp 12396.0 13305.0 21.304453611373525 56.502441550371536 -gcp 0.0 13305.0 21.29445052407418 56.53370151194224 Aizpute-1988-991/Aizpute-1988-991-19.jpg Aizpute-1988-991-19.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "1950.0 528.0\n508.5 10324.5\n10291.5 11728.5\n11673.0 1903.5" | \ gdaltransform -tps -output_xy Aizpute-1988-991-19.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-19.vrt Aizpute-1988-991-19.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-19.cut.vrt Aizpute-1988-991-19.xyz