#!/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 2442.543569863739 4000.181174549679 26.58369541 57.1713959 -gcp 19976.274378486385 5351.314071343008 26.5815711 57.10185055 -gcp 19260.379814639316 20311.568164224926 26.47378922 57.10060341 -gcp 2561.389596947735 18799.90012071339 26.47614956 57.16739685 GX10514/GX_10514_SK_frame_462.jpg GX_10514_SK_frame_462.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "576.0 3513.0\n20352.0 2831.598885793871\n20400.0 19728.0\n720.0 20016.187186629526" | \ gdaltransform -tps -output_xy GX_10514_SK_frame_462.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ GX_10514_SK_frame_462.vrt GX_10514_SK_frame_462.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES GX_10514_SK_frame_462.cut.vrt GX_10514_SK_frame_462.xyz