#!/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 4074.7153718676227 2597.1887588641616 24.65989709 57.27322545 -gcp 20544.149591077028 5907.223597387808 24.68568921 57.3392263 -gcp 16931.854304122226 19058.234130957942 24.78256524 57.32438976 -gcp 3678.3714459068124 16833.80851798459 24.7649914 57.27081823 GX8464/GX_8464_SK_frame_287.jpg GX_8464_SK_frame_287.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "744.0 2519.826183844011\n21024.0 2327.959888579387\n21048.0 19511.906406685237\n696.0 19727.866295264623" | \ gdaltransform -tps -output_xy GX_8464_SK_frame_287.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ GX_8464_SK_frame_287.vrt GX_8464_SK_frame_287.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES GX_8464_SK_frame_287.cut.vrt GX_8464_SK_frame_287.xyz