#!/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.304153203964233 56.51249745630148 -gcp 10500.0 0.0 21.302661895751957 56.485588840099155 -gcp 10500.0 12648.0 21.2441897392273 56.48654849838922 -gcp 0.0 12648.0 21.245895624160767 56.51337947982494 Aizpute-1988-991/Aizpute-1988-991-12.jpg Aizpute-1988-991-12.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "24.0 1356.0\n492.0 11250.0\n10353.0 10768.5\n9864.0 882.0" | \ gdaltransform -tps -output_xy Aizpute-1988-991-12.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-12.vrt Aizpute-1988-991-12.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-12.cut.vrt Aizpute-1988-991-12.xyz