#!/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.282421056904 56.616779303103 -gcp 11637.0 0.0 21.273731834865 56.587294288494 -gcp 11637.0 13032.0 21.214145202935 56.592395662661 -gcp 0.0 13032.0 21.221992211343 56.621942437349 Aizpute-1988-991/Aizpute-1988-991-70.jpg Aizpute-1988-991-70.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "132.0 1845.0\n9886.5 253.5\n11475.0 10038.0\n1700.25 11609.25" | \ gdaltransform -tps -output_xy Aizpute-1988-991-70.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-70.vrt Aizpute-1988-991-70.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-70.cut.vrt Aizpute-1988-991-70.xyz