#!/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 2817.0 1056.0 25.337216666666666 57.75 -gcp 16752.0 1056.0 25.837216666666666 57.75 -gcp 16788.0 14205.0 25.837216666666666 57.5 -gcp 2730.0 14172.0 25.337216666666666 57.5 bruno/R11_Wolmar.jpg R11_Wolmar.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "2817.0 1056.0\n16752.0 1056.0\n16788.0 14205.0\n2730.0 14172.0" | \ gdaltransform -tps -output_xy R11_Wolmar.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ R11_Wolmar.vrt R11_Wolmar.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES R11_Wolmar.cut.vrt R11_Wolmar.xyz