#!/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 2255.8696463822716 3502.603414948194 27.3814702 57.14532037 -gcp 20355.099470066176 2802.150792419625 27.37498999 57.21582101 -gcp 17024.954667089387 19568.770535736316 27.49381185 57.2059436 -gcp 3987.742720939932 19174.27358817729 27.49637067 57.15378244 GX10802/GX_10802_SK_frame_355.jpg GX_10802_SK_frame_355.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "720.0 2231.9732590529247\n21000.0 2256.3342618384404\n20712.0 19439.95988857939\n600.0 19320.0" | \ gdaltransform -tps -output_xy GX_10802_SK_frame_355.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ GX_10802_SK_frame_355.vrt GX_10802_SK_frame_355.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES GX_10802_SK_frame_355.cut.vrt GX_10802_SK_frame_355.xyz