#!/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.540069580078 56.640636908265 -gcp 11145.0 0.0 21.543180942535 56.612237036406 -gcp 11145.0 12759.0 21.484526395797 56.610087892665 -gcp 0.0 12759.0 21.480717658997 56.638654584923 Aizpute-1988-991/Aizpute-1988-991-84.jpg Aizpute-1988-991-84.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "1134.0 846.0\n10998.0 1290.0\n10548.0 11205.0\n684.0 10758.0" | \ gdaltransform -tps -output_xy Aizpute-1988-991-84.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-84.vrt Aizpute-1988-991-84.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-84.cut.vrt Aizpute-1988-991-84.xyz