#!/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 321.0 585.0 22.75 56.166666666666664 -gcp 8397.0 519.0 23 56.166666666666664 -gcp 8481.0 10137.0 23 56 -gcp 381.0 10200.0 22.75 56 mapster/RKKA050_O-34-142-D_Popelyany`_1932_greif.jpg RKKA050_O-34-142-D_Popelyany`_1932_greif.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "321.0 585.0\n8397.0 519.0\n8481.0 10137.0\n381.0 10200.0" | \ gdaltransform -tps -output_xy RKKA050_O-34-142-D_Popelyany`_1932_greif.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ RKKA050_O-34-142-D_Popelyany`_1932_greif.vrt RKKA050_O-34-142-D_Popelyany`_1932_greif.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES RKKA050_O-34-142-D_Popelyany`_1932_greif.cut.vrt RKKA050_O-34-142-D_Popelyany`_1932_greif.xyz