#!/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 855.0 537.0 21.326666666666668 56.5 -gcp 24033.0 690.0 21.776666666666667 56.5 -gcp 23886.0 27993.0 21.776666666666667 56.2 -gcp 612.0 27840.0 21.326666666666668 56.2 bruno/VI+VII-10_w.y.jpg VI+VII-10_w.y.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "855.0 537.0\n24033.0 690.0\n23886.0 27993.0\n612.0 27840.0" | \ gdaltransform -tps -output_xy VI+VII-10_w.y.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ VI+VII-10_w.y.vrt VI+VII-10_w.y.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES VI+VII-10_w.y.cut.vrt VI+VII-10_w.y.xyz