#!/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 25.35070469 57.57116237 -gcp 14076.0 0.0 25.54608931 57.54417021 -gcp 14076.0 14082.0 25.47639685 57.45452013 -gcp 0.0 14082.0 25.33186691 57.47474958 GX954/GX_954_SK_frame_14.jpg GX_954_SK_frame_14.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "432.0 1416.0266814897163\n13848.0 1439.8799332962758\n13680.0 12719.973318510281\n408.0 13128.013340744857" | \ gdaltransform -tps -output_xy GX_954_SK_frame_14.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ GX_954_SK_frame_14.vrt GX_954_SK_frame_14.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES GX_954_SK_frame_14.cut.vrt GX_954_SK_frame_14.xyz