#!/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 26.78460870933194 57.017465435944544 -gcp 14340.0 0.0 27.119464958430676 57.01745524319347 -gcp 14340.0 16323.0 27.118756369836234 56.81041007172834 -gcp 0.0 16323.0 26.78487363671717 56.81036456771958 229-Kapuna_1925.jpg 229-Kapuna_1925.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e \"7164.75 1373.9975013881176\n1800.0 1380.0\n1792.5 14517.750416435316\n12528.0 14514.0\n12531.0 7957.881871182676\n12507.0 1377.0\" | \ gdaltransform -tps -output_xy 229-Kapuna_1925.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}'))))" \ 229-Kapuna_1925.vrt 229-Kapuna_1925.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES 229-Kapuna_1925.cut.vrt 229-Kapuna_1925.xyz