#!/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 2840.000991621537 4877.856466141326 25.49254596 57.17296618 -gcp 18617.334865395867 6313.588939065838 25.48343718 57.11016504 -gcp 19035.79259350036 17257.32469022285 25.4058516 57.10756977 -gcp 3858.450716533334 18801.852480836566 25.39017677 57.16759463 GX10514/GX_10514_SK_frame_441.jpg GX_10514_SK_frame_441.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "1200.0 4041.0\n20208.0 3552.5922879177388\n20304.0 20352.04935732648\n1248.0 20784.19742930591" | \ gdaltransform -tps -output_xy GX_10514_SK_frame_441.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ GX_10514_SK_frame_441.vrt GX_10514_SK_frame_441.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES GX_10514_SK_frame_441.cut.vrt GX_10514_SK_frame_441.xyz