#!/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.475044422748 56.681589219498 -gcp 11985.0 0.0 21.468452783993 56.651148817882 -gcp 11985.0 12951.0 21.408800948753 56.654829933777 -gcp 0.0 12951.0 21.415180692996 56.685541503394 Aizpute-1988-991/Aizpute-1988-991-114.jpg Aizpute-1988-991-114.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "615.0 1758.0\n10359.0 453.0\n11673.0 10257.0\n1894.5 11568.0" | \ gdaltransform -tps -output_xy Aizpute-1988-991-114.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-114.vrt Aizpute-1988-991-114.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-114.cut.vrt Aizpute-1988-991-114.xyz