#!/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 393.0 699.0 25.376666666666665 56.5 -gcp 15939.0 726.0 25.826666666666668 56.5 -gcp 15951.0 16329.0 25.826666666666668 56.25 -gcp 297.0 16290.0 25.376666666666665 56.25 bruno/VI-19_1927.jpg VI-19_1927.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "393.0 699.0\n15939.0 726.0\n15951.0 16329.0\n297.0 16290.0" | \ gdaltransform -tps -output_xy VI-19_1927.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ VI-19_1927.vrt VI-19_1927.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES VI-19_1927.cut.vrt VI-19_1927.xyz