#!/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.337326409505 56.556246552325 -gcp 11691.0 0.0 21.332311903846 56.526717987781 -gcp 11691.0 13275.0 21.271730661392 56.529317483536 -gcp 0.0 13275.0 21.276110635003 56.559258304057 Aizpute-1988-991/Aizpute-1988-991-39.jpg Aizpute-1988-991-39.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "561.0 2010.0\n10372.5 928.5\n11453.25 10798.5\n1640.25 11861.25" | \ gdaltransform -tps -output_xy Aizpute-1988-991-39.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-39.vrt Aizpute-1988-991-39.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-39.cut.vrt Aizpute-1988-991-39.xyz