#!/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 714.0 567.0 21.326666666666668 57 -gcp 11061.0 594.0 21.776666666666667 57 -gcp 11052.0 11028.0 21.776666666666667 56.75 -gcp 663.0 11007.0 21.326666666666668 56.75 bruno/IV-10_1916.jpg IV-10_1916.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "714.0 567.0\n11061.0 594.0\n11052.0 11028.0\n663.0 11007.0" | \ gdaltransform -tps -output_xy IV-10_1916.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ IV-10_1916.vrt IV-10_1916.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES IV-10_1916.cut.vrt IV-10_1916.xyz