#!/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 2211.0 2109.0 24.1349 57.754 -gcp 29469.0 2073.0 25.368466666666666 57.80485 -gcp 29382.0 21828.0 25.429566666666666 57.33153333333333 -gcp 2178.0 21762.0 24.215583333333335 57.2808 1915_3verst_de_126k/greif/Reihe_VII_Blatt_4_Lemsal_1914_greif.jpg Reihe_VII_Blatt_4_Lemsal_1914_greif.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "2211.0 2109.0\n15844.5 2059.482509716824\n29469.0 2073.0\n29442.0 11967.004997223765\n29382.0 21828.0\n15777.75 21803.254580788453\n2178.0 21762.0" | \ gdaltransform -tps -output_xy Reihe_VII_Blatt_4_Lemsal_1914_greif.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Reihe_VII_Blatt_4_Lemsal_1914_greif.vrt Reihe_VII_Blatt_4_Lemsal_1914_greif.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Reihe_VII_Blatt_4_Lemsal_1914_greif.cut.vrt Reihe_VII_Blatt_4_Lemsal_1914_greif.xyz