#!/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 2721.0 3801.0 26.789983333333332 55.94805 -gcp 43665.0 3285.0 27.96998333333333 55.976483333333334 -gcp 43941.0 32691.0 28.0002 55.501216666666664 -gcp 3048.0 33138.0 26.836 55.47593333333333 1915_3verst_de_126k/loc/Reihe_XI_Blatt_6_Drissa_1915_loc.jpg Reihe_XI_Blatt_6_Drissa_1915_loc.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "2721.0 3801.0\n23190.0 3491.9716823986673\n43665.0 3285.0\n43830.0 18009.011660188782\n43941.0 32691.0\n23491.5 32919.00249861188\n3048.0 33138.0" | \ gdaltransform -tps -output_xy Reihe_XI_Blatt_6_Drissa_1915_loc.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Reihe_XI_Blatt_6_Drissa_1915_loc.vrt Reihe_XI_Blatt_6_Drissa_1915_loc.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Reihe_XI_Blatt_6_Drissa_1915_loc.cut.vrt Reihe_XI_Blatt_6_Drissa_1915_loc.xyz