#!/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.501231955465 56.554913358901 -gcp 11586.0 0.0 21.495080927191 56.52541891677 -gcp 11586.0 13428.0 21.433306916228 56.529227082835 -gcp 0.0 13428.0 21.439361384977 56.558869387453 Aizpute-1988-991/Aizpute-1988-991-32.jpg Aizpute-1988-991-32.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "223.5 2169.0\n1467.0 11995.5\n11262.0 10764.0\n10011.0 922.5" | \ gdaltransform -tps -output_xy Aizpute-1988-991-32.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-32.vrt Aizpute-1988-991-32.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-32.cut.vrt Aizpute-1988-991-32.xyz