#!/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 1734.0 3291.0 23.75 57 -gcp 16083.0 3222.0 24 57 -gcp 16113.0 20748.0 24 56.833333333333336 -gcp 1686.0 20802.0 23.75 56.833333333333336 mapster/O-34-120-B_(MAJORI)_1939_greif.jpg O-34-120-B_(MAJORI)_1939_greif.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "1734.0 3291.0\n16083.0 3222.0\n16113.0 20748.0\n1686.0 20802.0" | \ gdaltransform -tps -output_xy O-34-120-B_(MAJORI)_1939_greif.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ O-34-120-B_(MAJORI)_1939_greif.vrt O-34-120-B_(MAJORI)_1939_greif.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES O-34-120-B_(MAJORI)_1939_greif.cut.vrt O-34-120-B_(MAJORI)_1939_greif.xyz