#!/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.553585497421 56.576556220907 -gcp 10509.0 0.0 21.555944919088 56.549943236677 -gcp 10509.0 12090.0 21.500287055969 56.548306491658 -gcp 0.0 12090.0 21.498146653175 56.575099686609 Aizpute-1988-991/Aizpute-1988-991-55.jpg Aizpute-1988-991-55.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "6.0 6966.0\n177.0 888.0\n10014.0 1138.5\n9754.5 11029.5\n4.5 10758.0" | \ gdaltransform -tps -output_xy Aizpute-1988-991-55.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-55.vrt Aizpute-1988-991-55.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-55.cut.vrt Aizpute-1988-991-55.xyz