#!/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 24.99501228 56.9309619 -gcp 11250.0 0.0 25.01749992 57.03061887 -gcp 11250.0 11250.0 25.1941824 57.01394028 -gcp 0.0 11250.0 25.17229557 56.92282371 GX825/GX_825_SK_frame_73.jpg GX_825_SK_frame_73.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "504.0 1293.6601671309195\n10800.0 1104.0534818941505\n10704.0 9935.973259052924\n528.0 9815.95988857939" | \ gdaltransform -tps -output_xy GX_825_SK_frame_73.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ GX_825_SK_frame_73.vrt GX_825_SK_frame_73.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES GX_825_SK_frame_73.cut.vrt GX_825_SK_frame_73.xyz