#!/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 3624.780192838465 5491.195861974653 25.37507594 57.16905183 -gcp 18812.129896964656 5855.575419197945 25.375489 57.10912829 -gcp 18158.926381253066 19305.56040105586 25.27888656 57.1094258 -gcp 3791.1138747928453 18683.073512352443 25.27900457 57.16667254 GX10514/GX_10514_SK_frame_439.jpg GX_10514_SK_frame_439.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "912.0 3801.0\n20640.0 3215.5557840616966\n20784.0 20543.97532133676\n1104.0 20640.22210796915" | \ gdaltransform -tps -output_xy GX_10514_SK_frame_439.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ GX_10514_SK_frame_439.vrt GX_10514_SK_frame_439.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES GX_10514_SK_frame_439.cut.vrt GX_10514_SK_frame_439.xyz