#!/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.84152544 55.75091048 -gcp 14460.0 0.0 26.80621147 55.7306927 -gcp 14460.0 14169.0 26.7686043 55.75012661 -gcp 0.0 14169.0 26.80584669 55.77180577 GX616/GX_616_SD_frame_72.jpg GX_616_SD_frame_72.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "384.0 1419.0\n1380.0 1350.25069637883\n1458.0 390.0033426183844\n11844.0 455.39832869080783\n11826.0 1661.9966573816155\n13896.0 1692.0534818941505\n14040.0 13932.020055710307\n1776.0 13872.213927576602\n1536.0 12935.772701949862\n576.0 12816.294150417827" | \ gdaltransform -tps -output_xy GX_616_SD_frame_72.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ GX_616_SD_frame_72.vrt GX_616_SD_frame_72.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES GX_616_SD_frame_72.cut.vrt GX_616_SD_frame_72.xyz