#!/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 884.2604231149026 4739.4593120370855 25.03423691 57.18264014 -gcp 19423.512140039846 5671.852333493512 25.03461242 57.10739786 -gcp 18828.980678505566 18752.749007672013 24.93884683 57.10654726 -gcp 1456.4762623498484 19520.789944092776 24.92420197 57.17690044 GX10514/GX_10514_SK_frame_433.jpg GX_10514_SK_frame_433.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "1080.0 3624.25912596401\n21168.0 3503.901285347044\n21168.0 20736.937789203086\n840.0 20617.54241645244" | \ gdaltransform -tps -output_xy GX_10514_SK_frame_433.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ GX_10514_SK_frame_433.vrt GX_10514_SK_frame_433.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES GX_10514_SK_frame_433.cut.vrt GX_10514_SK_frame_433.xyz