#!/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 3119.0024772987354 3263.914199809573 24.59971905 57.26879353 -gcp 20595.48854105199 5896.371252563279 24.62120891 57.33967228 -gcp 20077.359075128414 18745.211819494496 24.71582651 57.33648116 -gcp 4573.527080651709 20871.51946440364 24.73003149 57.27411322 GX8464/GX_8464_SK_frame_288.jpg GX_8464_SK_frame_288.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "588.0 2808.1604456824516\n20976.0 2592.147075208914\n21072.0 19872.200557103064\n696.0 19968.133704735377" | \ gdaltransform -tps -output_xy GX_8464_SK_frame_288.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ GX_8464_SK_frame_288.vrt GX_8464_SK_frame_288.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES GX_8464_SK_frame_288.cut.vrt GX_8464_SK_frame_288.xyz