#!/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 2745.0 3735.0 24.215583333333335 57.2808 -gcp 44001.0 3618.0 25.429566666666666 57.33153333333333 -gcp 43962.0 33387.0 25.490083333333335 56.85845 -gcp 2844.0 33432.0 24.295066666666667 56.80938333333334 1915_3verst_de_126k/loc/Reihe_VIII_Blatt_4_Wenden_1916_loc.jpg Reihe_VIII_Blatt_4_Wenden_1916_loc.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "2745.0 3735.0\n23349.75 3645.7329261521377\n44001.0 3618.0\n43971.75 18505.501665741256\n43962.0 33387.0\n2844.0 33432.0" | \ gdaltransform -tps -output_xy Reihe_VIII_Blatt_4_Wenden_1916_loc.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Reihe_VIII_Blatt_4_Wenden_1916_loc.vrt Reihe_VIII_Blatt_4_Wenden_1916_loc.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Reihe_VIII_Blatt_4_Wenden_1916_loc.cut.vrt Reihe_VIII_Blatt_4_Wenden_1916_loc.xyz