#!/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 2604.0 1452.0 23.576666666666668 56.25 -gcp 18144.0 1434.0 24.026666666666667 56.25 -gcp 18246.0 16878.0 24.026666666666667 56 -gcp 2643.0 16917.0 23.576666666666668 56 bruno/VII-15_w.y..jpg VII-15_w.y..vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "2610.75 9186.75124930594\n2604.0 1452.0\n10377.0 1405.4791782343143\n18144.0 1434.0\n18208.5 9165.004997223765\n18246.0 16878.0\n2643.0 16917.0" | \ gdaltransform -tps -output_xy VII-15_w.y..vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ VII-15_w.y..vrt VII-15_w.y..cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES VII-15_w.y..cut.vrt VII-15_w.y..xyz