#!/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 4195.851083287298 4680.883640216556 24.73168373 57.27513385 -gcp 18523.965567430147 4111.335340849666 24.72841144 57.33280499 -gcp 17954.17306944233 19623.570814541625 24.84285593 57.33004254 -gcp 4567.131943881877 19583.890570869462 24.84146118 57.27610236 GX8464/GX_8464_SK_frame_286.jpg GX_8464_SK_frame_286.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "576.0 2838.0\n20784.0 2400.5615598885793\n20640.0 19679.946518105848\n528.0 19968.454596100277" | \ gdaltransform -tps -output_xy GX_8464_SK_frame_286.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ GX_8464_SK_frame_286.vrt GX_8464_SK_frame_286.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES GX_8464_SK_frame_286.cut.vrt GX_8464_SK_frame_286.xyz