#!/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 2929.2215837193617 2943.5416616063167 26.59540325 57.17042145 -gcp 19340.562970911375 6327.550927142822 26.581496 57.10451951 -gcp 19215.08903514519 17665.928486115452 26.50011778 57.10097366 -gcp 4798.968143412927 20344.621158568843 26.47062421 57.15690722 GX10514/GX_10514_SK_frame_463.jpg GX_10514_SK_frame_463.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "648.0 3119.7860724233988\n20712.0 2952.066852367688\n20832.0 20184.254038997213\n720.0 20016.187186629526" | \ gdaltransform -tps -output_xy GX_10514_SK_frame_463.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ GX_10514_SK_frame_463.vrt GX_10514_SK_frame_463.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES GX_10514_SK_frame_463.cut.vrt GX_10514_SK_frame_463.xyz