#!/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 2436.0 2196.0 22.226666666666667 57.75 -gcp 27615.0 2262.0 22.826666666666668 57.75 -gcp 27666.0 22131.0 22.826666666666668 57.5 -gcp 2280.0 21990.0 22.226666666666667 57.5 lnb/I-12_20053899.jpg I-12_20053899.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "2436.0 2196.0\n13602.0 2232.0399777901166\n13606.5 1091.9800111049417\n19890.0 1104.0\n19902.0 2232.006662965019\n27615.0 2262.0\n27666.0 22131.0\n2280.0 21990.0" | \ gdaltransform -tps -output_xy I-12_20053899.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ I-12_20053899.vrt I-12_20053899.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES I-12_20053899.cut.vrt I-12_20053899.xyz