#!/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 462.0 264.0 20.876666666666665 57 -gcp 15813.0 282.0 21.326666666666668 57 -gcp 15858.0 15819.0 21.326666666666668 56.75 -gcp 426.0 15810.0 20.876666666666665 56.75 bruno/IV-9_w.y.jpg IV-9_w.y.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "462.0 264.0\n15813.0 282.0\n15858.0 15819.0\n426.0 15810.0" | \ gdaltransform -tps -output_xy IV-9_w.y.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ IV-9_w.y.vrt IV-9_w.y.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES IV-9_w.y.cut.vrt IV-9_w.y.xyz