#!/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.531588435173 56.577312884594 -gcp 10548.0 0.0 21.533154845238 56.550453248121 -gcp 10548.0 12366.0 21.475986242294 56.54915515756 -gcp 0.0 12366.0 21.474586129189 56.576225504904 Aizpute-1988-991/Aizpute-1988-991-54.jpg Aizpute-1988-991-54.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "375.0 1203.0\n10206.0 1245.0\n10167.0 11128.5\n310.5 11073.0" | \ gdaltransform -tps -output_xy Aizpute-1988-991-54.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-54.vrt Aizpute-1988-991-54.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-54.cut.vrt Aizpute-1988-991-54.xyz