#!/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.87518978 56.62925474 -gcp 14289.0 0.0 27.85495944 56.70181637 -gcp 14289.0 14211.0 27.9928541 56.72204178 -gcp 0.0 14211.0 28.02734613 56.63663082 GX1642/GX_1642_SK_frame_26.jpg GX_1642_SK_frame_26.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "672.0 1515.0\n1788.0 1452.227298050139\n1920.0 575.6791086350968\n14244.0 623.9130919220054\n14280.0 13992.0\n1632.0 14028.086908077994\n1608.0 12815.61225626741\n600.0 12792.133704735377" | \ gdaltransform -tps -output_xy GX_1642_SK_frame_26.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ GX_1642_SK_frame_26.vrt GX_1642_SK_frame_26.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES GX_1642_SK_frame_26.cut.vrt GX_1642_SK_frame_26.xyz