#!/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 3541.3767941828323 4262.885575736462 25.73317766 57.27327761 -gcp 14115.88148722393 3811.8134698598683 25.73146105 57.31431562 -gcp 20476.753956120363 17215.714361662962 25.83024144 57.33744905 -gcp 1533.0124189591593 17622.130464715956 25.82895398 57.26424607 GX8464/GX_8464_SK_frame_269.jpg GX_8464_SK_frame_269.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "-96.0 2688.0\n20760.0 2401.206636500753\n20856.0 19870.22624434389\n-192.0 19630.105580693817" | \ gdaltransform -tps -output_xy GX_8464_SK_frame_269.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ GX_8464_SK_frame_269.vrt GX_8464_SK_frame_269.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES GX_8464_SK_frame_269.cut.vrt GX_8464_SK_frame_269.xyz