#!/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 2499.0 3681.0 27.939783333333335 56.44968333333333 -gcp 43764.0 3510.0 29.1317 56.465333333333334 -gcp 43782.0 33180.0 29.14655 55.99118333333333 -gcp 2601.0 33303.0 27.96998333333333 55.976483333333334 1915_3verst_de_126k/loc/Reihe_X_Blatt_7_Sebesh_1915_loc.jpg Reihe_X_Blatt_7_Sebesh_1915_loc.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "2499.0 3681.0\n23118.0 3544.4716823986673\n43764.0 3510.0\n43780.5 18354.004997223765\n43782.0 33180.0\n23184.0 33197.97501388118\n2601.0 33303.0" | \ gdaltransform -tps -output_xy Reihe_X_Blatt_7_Sebesh_1915_loc.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Reihe_X_Blatt_7_Sebesh_1915_loc.vrt Reihe_X_Blatt_7_Sebesh_1915_loc.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Reihe_X_Blatt_7_Sebesh_1915_loc.cut.vrt Reihe_X_Blatt_7_Sebesh_1915_loc.xyz