#!/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 0.0 0.0 25.77409744 56.99087184 -gcp 11304.0 0.0 25.83857775 56.89739064 -gcp 11304.0 10980.0 25.67699075 56.86655177 -gcp 0.0 10980.0 25.61494589 56.95362182 GX825/GX_825_SK_frame_88.jpg GX_825_SK_frame_88.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "720.0 1251.0\n10896.0 1151.893036211699\n10752.0 9792.080222841225\n648.0 9816.04011142061" | \ gdaltransform -tps -output_xy GX_825_SK_frame_88.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ GX_825_SK_frame_88.vrt GX_825_SK_frame_88.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES GX_825_SK_frame_88.cut.vrt GX_825_SK_frame_88.xyz