#!/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 567.0 828.0 26.75 56.666666666666664 -gcp 11427.0 846.0 27 56.666666666666664 -gcp 11430.0 14004.0 27 56.5 -gcp 501.0 13968.0 26.75 56.5 mapster/RKKA050_O-35-126-B_Vilany`_1939_greif.jpg RKKA050_O-35-126-B_Vilany`_1939_greif.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "567.0 828.0\n11427.0 846.0\n11430.0 14004.0\n501.0 13968.0" | \ gdaltransform -tps -output_xy RKKA050_O-35-126-B_Vilany`_1939_greif.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ RKKA050_O-35-126-B_Vilany`_1939_greif.vrt RKKA050_O-35-126-B_Vilany`_1939_greif.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES RKKA050_O-35-126-B_Vilany`_1939_greif.cut.vrt RKKA050_O-35-126-B_Vilany`_1939_greif.xyz