#!/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.25934958457947 56.51279639945941 -gcp 10503.0 0.0 21.257203817367557 56.485956119595684 -gcp 10503.0 12567.0 21.199257373809818 56.487152715230906 -gcp 0.0 12567.0 21.201049089431763 56.51407206109191 Aizpute-1988-991/Aizpute-1988-991-14.jpg Aizpute-1988-991-14.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "129.0 1395.0\n633.0 11283.0\n10479.0 10785.0\n9984.0 885.0" | \ gdaltransform -tps -output_xy Aizpute-1988-991-14.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-14.vrt Aizpute-1988-991-14.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-14.cut.vrt Aizpute-1988-991-14.xyz