#!/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.440093509174897 56.51327461974144 -gcp 10857.0 0.0 21.437309696598778 56.48547284204514 -gcp 10857.0 12480.0 21.37979084203756 56.48685679190018 -gcp 0.0 12480.0 21.38245127299898 56.514584809125964 Aizpute-1988-991/Aizpute-1988-991-6.jpg Aizpute-1988-991-6.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "255.0 1173.0\n10116.0 663.0\n10620.0 10566.0\n762.0 11070.0" | \ gdaltransform -tps -output_xy Aizpute-1988-991-6.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-6.vrt Aizpute-1988-991-6.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-6.cut.vrt Aizpute-1988-991-6.xyz