#!/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 2262.0 780.0 20.837216666666666 56.25 -gcp 16830.0 789.0 21.337216666666666 56.25 -gcp 16863.0 13914.0 21.337216666666666 56 -gcp 2193.0 13932.0 20.837216666666666 56 bruno/H17_1921_Dorbiany.jpg H17_1921_Dorbiany.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "2262.0 780.0\n16830.0 789.0\n16863.0 13914.0\n2193.0 13932.0" | \ gdaltransform -tps -output_xy H17_1921_Dorbiany.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ H17_1921_Dorbiany.vrt H17_1921_Dorbiany.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES H17_1921_Dorbiany.cut.vrt H17_1921_Dorbiany.xyz