#!/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 1379.25 1440.0981894150418 26 56.25 -gcp 12603.75 1437.9050139275766 26.5 56.25 -gcp 12641.25 11466.992339832868 26.5 56 -gcp 1329.0 11468.444289693594 26 56 78-Bebrene_1939.jpg 78-Bebrene_1939.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e \"1379.25 1440.0981894150418\n12603.75 1437.9050139275766\n12641.25 11466.992339832868\n1329.0 11468.444289693594\" | \ gdaltransform -tps -output_xy 78-Bebrene_1939.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}'))))" \ 78-Bebrene_1939.vrt 78-Bebrene_1939.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES 78-Bebrene_1939.cut.vrt 78-Bebrene_1939.xyz