#!/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 4483.500000000002 6256.8167182662655 22.5995636 57.76427212 -gcp 14445.968617604029 6807.331357798481 27.5592041 57.53277935 -gcp 14942.999999999822 13311.685448916489 27.62374878 55.79394767 -gcp 1321.5000000000105 12401.246749226073 21.0710907 56.07318734 -gcp 7389.0 8865.483900928793 24.02709961 57.06092447 -gcp 9135.0 11109.693808049535 24.89261627 56.44886362 k_001_ktl1-4-48_2.jpg k_001_ktl1-4-48_2.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "0.0 0.0\n16653.0 0.0\n16653.0 20841.0\n0.0 20841.0" | \ gdaltransform -tps -output_xy k_001_ktl1-4-48_2.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ k_001_ktl1-4-48_2.vrt k_001_ktl1-4-48_2.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES k_001_ktl1-4-48_2.cut.vrt k_001_ktl1-4-48_2.xyz