#!/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.41548846540952 56.513451515272635 -gcp 10524.0 0.0 21.415500466093047 56.48656759997454 -gcp 10524.0 12207.0 21.359594339085692 56.48654653684344 -gcp 0.0 12207.0 21.35914782054175 56.51333872050945 Aizpute-1988-991/Aizpute-1988-991-7.jpg Aizpute-1988-991-7.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "228.0 906.0\n10098.0 780.0\n10215.0 10701.0\n339.0 10815.0" | \ gdaltransform -tps -output_xy Aizpute-1988-991-7.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-7.vrt Aizpute-1988-991-7.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-7.cut.vrt Aizpute-1988-991-7.xyz