#!/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 3450.0 3588.0 23.093783333333334 56.74915 -gcp 44511.0 3051.0 24.295066666666667 56.80938333333334 -gcp 44691.0 32808.0 24.373166666666666 56.33838333333333 -gcp 3756.0 33114.0 23.18235 56.2773 1915_3verst_de_126k/loc/Reihe_IX_Blatt_3_Mittau_1916_loc.jpg Reihe_IX_Blatt_3_Mittau_1916_loc.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "3450.0 3588.0\n44511.0 3051.0\n44691.0 32808.0\n3756.0 33114.0" | \ gdaltransform -tps -output_xy Reihe_IX_Blatt_3_Mittau_1916_loc.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Reihe_IX_Blatt_3_Mittau_1916_loc.vrt Reihe_IX_Blatt_3_Mittau_1916_loc.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Reihe_IX_Blatt_3_Mittau_1916_loc.cut.vrt Reihe_IX_Blatt_3_Mittau_1916_loc.xyz