#!/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 26.84603691 55.92239767 -gcp 14082.0 0.0 26.85157299 55.84996329 -gcp 14082.0 14376.0 26.67508364 55.84586759 -gcp 0.0 14376.0 26.66529894 55.88253276 GX823/GX_823_SD_frame_80.jpg GX_823_SD_frame_80.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "432.0 1827.0\n1344.0 1464.1337047353763\n1752.0 623.7058495821727\n12600.0 479.3047353760444\n12648.0 1584.307520891365\n13800.0 1608.0935933147634\n13824.0 13800.0\n408.0 13872.267409470753" | \ gdaltransform -tps -output_xy GX_823_SD_frame_80.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ GX_823_SD_frame_80.vrt GX_823_SD_frame_80.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES GX_823_SD_frame_80.cut.vrt GX_823_SD_frame_80.xyz