#!/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 3201.0 4107.0 24.1349 57.754 -gcp 44166.0 4173.0 25.368466666666666 57.80485 -gcp 43950.0 33852.0 25.429566666666666 57.33153333333333 -gcp 3102.0 33645.0 24.215583333333335 57.2808 1915_3verst_de_126k/loc/Reihe_VII_Blatt_4_Lemsal_1915_loc.jpg Reihe_VII_Blatt_4_Lemsal_1915_loc.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "3133.5 18885.004997223765\n3201.0 4107.0\n23671.5 4072.4625208217653\n44166.0 4173.0\n43950.0 33852.0\n23523.0 33762.00666296502\n3102.0 33645.0" | \ gdaltransform -tps -output_xy Reihe_VII_Blatt_4_Lemsal_1915_loc.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Reihe_VII_Blatt_4_Lemsal_1915_loc.vrt Reihe_VII_Blatt_4_Lemsal_1915_loc.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_1915_loc.cut.vrt Reihe_VII_Blatt_4_Lemsal_1915_loc.xyz