#!/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 27.04712749 56.14405525 -gcp 14376.0 0.0 27.02216148 56.12025302 -gcp 14376.0 14040.0 26.9787097 56.13370749 -gcp 0.0 14040.0 27.0053494 56.15855895 GX739/GX_739_SD_frame_88.jpg GX_739_SD_frame_88.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "600.0 1199.959888579387\n1596.0 1164.233983286908\n1716.0 287.28467966573794\n11304.0 383.59220055710284\n11376.0 1920.033426183844\n13932.0 1943.8796657381617\n14004.0 14004.066852367687\n1596.0 13980.086908077994\n1308.0 12743.699164345404\n432.0 12659.95320334262" | \ gdaltransform -tps -output_xy GX_739_SD_frame_88.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ GX_739_SD_frame_88.vrt GX_739_SD_frame_88.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES GX_739_SD_frame_88.cut.vrt GX_739_SD_frame_88.xyz