#!/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 414.0 324.0 21.326666666666668 57.25 -gcp 15528.0 291.0 21.776666666666667 57.25 -gcp 15690.0 15915.0 21.776666666666667 57 -gcp 456.0 15966.0 21.326666666666668 57 bruno/III-10_w.y.jpg III-10_w.y.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "414.0 324.0\n15528.0 291.0\n15690.0 15915.0\n456.0 15966.0" | \ gdaltransform -tps -output_xy III-10_w.y.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ III-10_w.y.vrt III-10_w.y.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES III-10_w.y.cut.vrt III-10_w.y.xyz