#!/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 2268.0 3018.0 27.775933333333334 58.8204 -gcp 43497.0 2733.0 29.052983333333334 58.83853333333333 -gcp 43623.0 32406.0 29.068483333333333 58.3633 -gcp 2385.0 32646.0 27.812216666666668 58.346266666666665 1915_3verst_de_126k/loc/Reihe_V_Blatt_7_Gdow_1915_loc.jpg Reihe_V_Blatt_7_Gdow_1915_loc.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "2340.75 17842.505830094393\n2268.0 3018.0\n22878.0 2866.495002776235\n43497.0 2733.0\n43567.5 17575.50333148251\n43623.0 32406.0\n2385.0 32646.0" | \ gdaltransform -tps -output_xy Reihe_V_Blatt_7_Gdow_1915_loc.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Reihe_V_Blatt_7_Gdow_1915_loc.vrt Reihe_V_Blatt_7_Gdow_1915_loc.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Reihe_V_Blatt_7_Gdow_1915_loc.cut.vrt Reihe_V_Blatt_7_Gdow_1915_loc.xyz