#!/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 0.0 0.0 27.782439070297002 57.51762014288646 -gcp 14520.0 0.0 28.126646457545263 57.518429644699054 -gcp 14520.0 16683.0 28.126683917678065 57.306969460277415 -gcp 0.0 16683.0 27.784444172760786 57.306274899110804 273-Golubava_1923.jpg 273-Golubava_1923.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e \"1860.0 1395.0\n1821.0 7977.001665741254\n1799.625 14552.812395891171\n12405.375 14592.750416435316\n12417.0 8013.749375347029\n12415.875 1437.373542476402\" | \ gdaltransform -tps -output_xy 273-Golubava_1923.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}'))))" \ 273-Golubava_1923.vrt 273-Golubava_1923.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES 273-Golubava_1923.cut.vrt 273-Golubava_1923.xyz