#!/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 0.0 0.0 21.552432981784 56.513359010497 -gcp 10509.0 0.0 21.551918782796 56.486687760499 -gcp 10509.0 12192.0 21.496061525072 56.486804831538 -gcp 0.0 12192.0 21.496538173133 56.513641895046 Aizpute-1988-991/Aizpute-1988-991-2.jpg Aizpute-1988-991-2.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "354.0 882.0\n10224.0 564.0\n10489.5 9007.5\n10497.0 10476.0\n672.0 10794.0" | \ gdaltransform -tps -output_xy Aizpute-1988-991-2.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-2.vrt Aizpute-1988-991-2.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-2.cut.vrt Aizpute-1988-991-2.xyz