#!/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 411.0 834.0 26.25 57 -gcp 11196.0 768.0 26.5 57 -gcp 11304.0 13899.0 26.5 56.833333333333336 -gcp 465.0 13959.0 26.25 56.833333333333336 mapster/RKKA050_O-35-113-B_Ze`svaine`_1938_greif.jpg RKKA050_O-35-113-B_Ze`svaine`_1938_greif.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "411.0 834.0\n11196.0 768.0\n11304.0 13899.0\n465.0 13959.0" | \ gdaltransform -tps -output_xy RKKA050_O-35-113-B_Ze`svaine`_1938_greif.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ RKKA050_O-35-113-B_Ze`svaine`_1938_greif.vrt RKKA050_O-35-113-B_Ze`svaine`_1938_greif.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES RKKA050_O-35-113-B_Ze`svaine`_1938_greif.cut.vrt RKKA050_O-35-113-B_Ze`svaine`_1938_greif.xyz