#!/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 2523.0 1305.0 21.326666666666668 55.75 -gcp 18249.0 1332.0 21.776666666666667 55.75 -gcp 18279.0 16830.0 21.776666666666667 55.5 -gcp 2421.0 16848.0 21.326666666666668 55.5 bruno/IX-10_w.y.jpg IX-10_w.y.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "2523.0 1305.0\n18249.0 1332.0\n18279.0 16830.0\n2421.0 16848.0" | \ gdaltransform -tps -output_xy IX-10_w.y.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ IX-10_w.y.vrt IX-10_w.y.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES IX-10_w.y.cut.vrt IX-10_w.y.xyz