#!/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 565.2236112703966 1539.0375075965226 25.31974196 57.15304324 -gcp 17709.93649050103 2606.8042395479188 25.32774568 57.22049191 -gcp 16941.797261367814 16368.748153822105 25.4277277 57.21767988 -gcp 1064.7044922728542 14146.593268589237 25.41258931 57.15478904 GX10802/c_GX_10802_SK_frame_394.jpg c_GX_10802_SK_frame_394.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "0.0 0.0\n20430.0 0.0\n20430.0 17085.0\n0.0 17085.0" | \ gdaltransform -tps -output_xy c_GX_10802_SK_frame_394.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ c_GX_10802_SK_frame_394.vrt c_GX_10802_SK_frame_394.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES c_GX_10802_SK_frame_394.cut.vrt c_GX_10802_SK_frame_394.xyz