#!/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.406259684277583 56.6824056894712 -gcp 11823.0 0.0 21.399984559999783 56.6521244637453 -gcp 11823.0 13089.0 21.339082381818006 56.6559489276208 -gcp 0.0 13089.0 21.34556135398093 56.686271458232156 Aizpute-1988-991/Aizpute-1988-991-117.jpg Aizpute-1988-991-117.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "618.0 2058.0\n10404.0 834.0\n11631.0 10647.0\n1846.5 11877.0" | \ gdaltransform -tps -output_xy Aizpute-1988-991-117.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-117.vrt Aizpute-1988-991-117.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-117.cut.vrt Aizpute-1988-991-117.xyz