#!/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.540114632826413 56.68407499841583 -gcp 11721.0 0.0 21.54537211524973 56.65447791681069 -gcp 11721.0 12993.0 21.485643088357506 56.650929116048715 -gcp 0.0 12993.0 21.48023003781122 56.68064432854819 Aizpute-1988-991/Aizpute-1988-991-111.jpg Aizpute-1988-991-111.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "1557.0 801.0\n11382.0 1653.0\n10515.0 11508.0\n688.5 10663.5" | \ gdaltransform -tps -output_xy Aizpute-1988-991-111.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-111.vrt Aizpute-1988-991-111.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-111.cut.vrt Aizpute-1988-991-111.xyz