#!/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 2316.0 2484.0 25.549733333333332 56.38473333333334 -gcp 29469.0 2535.0 26.743133333333333 56.423116666666665 -gcp 29436.0 22098.0 26.789983333333332 55.94805 -gcp 2205.0 22176.0 25.6084 55.9133 1915_3verst_de_126k/greif/Reihe_X_Blatt_5_Illuxt_1914_greif.jpg Reihe_X_Blatt_5_Illuxt_1914_greif.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "2316.0 2484.0\n15888.0 2480.984175458079\n29469.0 2535.0\n29415.75 12325.504997223765\n29436.1875 22097.998334258744\n15813.75 22179.77373681288\n9006.0 22192.508328706273\n2205.0 22176.0" | \ gdaltransform -tps -output_xy Reihe_X_Blatt_5_Illuxt_1914_greif.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Reihe_X_Blatt_5_Illuxt_1914_greif.vrt Reihe_X_Blatt_5_Illuxt_1914_greif.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Reihe_X_Blatt_5_Illuxt_1914_greif.cut.vrt Reihe_X_Blatt_5_Illuxt_1914_greif.xyz