#!/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.73211551 57.07576425 -gcp 10980.0 0.0 25.73877811 56.98953395 -gcp 10980.0 11124.0 25.5759573 56.98444241 -gcp 0.0 11124.0 25.56728498 57.07275014 GX220/GX_220_SK_frame_582.jpg GX_220_SK_frame_582.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "456.0 1295.959888579387\n10656.0 1056.0\n10656.0 9623.933147632313\n432.0 9672.04011142061" | \ gdaltransform -tps -output_xy GX_220_SK_frame_582.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ GX_220_SK_frame_582.vrt GX_220_SK_frame_582.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES GX_220_SK_frame_582.cut.vrt GX_220_SK_frame_582.xyz