#!/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 2742.2948878905972 7650.617906171687 26.67613506 57.17127654 -gcp 19468.070346009834 4107.251677963404 26.71111643 57.10708591 -gcp 18433.12142517516 18413.94825148804 26.60944462 57.10569705 -gcp 2109.091502960445 18568.212829667307 26.59590483 57.17039837 GX10514/GX_10514_SK_frame_465.jpg GX_10514_SK_frame_465.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "768.0 3078.0\n20880.0 3455.9465181058495\n20832.0 20399.973259052927\n720.0 19968.240668523675" | \ gdaltransform -tps -output_xy GX_10514_SK_frame_465.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ GX_10514_SK_frame_465.vrt GX_10514_SK_frame_465.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES GX_10514_SK_frame_465.cut.vrt GX_10514_SK_frame_465.xyz