#!/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 648.0 822.0 27 58 -gcp 11205.0 888.0 28.5 58 -gcp 11313.0 14022.0 28.5 57 -gcp 480.0 13974.0 27 57 35_Petseri_1933.jpg 35_Petseri_1933.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e \"651.0 822.0\n480.0 13977.0\n11313.0 14022.0\n11205.0 888.0\" | \ gdaltransform -tps -output_xy 35_Petseri_1933.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}'))))" \ 35_Petseri_1933.vrt 35_Petseri_1933.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES 35_Petseri_1933.cut.vrt 35_Petseri_1933.xyz