#!/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.390018842381 56.576530662468 -gcp 10509.0 0.0 21.391595741215 56.549655070517 -gcp 10509.0 12522.0 21.333620462818 56.548498340394 -gcp 0.0 12522.0 21.332011377476 56.57543602709 Aizpute-1988-991/Aizpute-1988-991-48.jpg Aizpute-1988-991-48.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "207.0 1227.0\n10068.0 1179.0\n10126.5 11079.0\n232.5 11104.5" | \ gdaltransform -tps -output_xy Aizpute-1988-991-48.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-48.vrt Aizpute-1988-991-48.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-48.cut.vrt Aizpute-1988-991-48.xyz