#!/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 2358.0 2025.0 21.626666666666665 57.75 -gcp 27537.0 2019.0 22.226666666666667 57.75 -gcp 27588.0 22152.0 22.226666666666667 57.5 -gcp 2172.0 22092.0 21.626666666666665 57.5 lnb/I-11_20053893.jpg I-11_20053893.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "2358.0 2025.0\n27537.0 2019.0\n27588.0 22152.0\n2172.0 22092.0" | \ gdaltransform -tps -output_xy I-11_20053893.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ I-11_20053893.vrt I-11_20053893.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES I-11_20053893.cut.vrt I-11_20053893.xyz