#!/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.532504726077747 57.01703343131232 -gcp 14340.0 0.0 26.867833811438693 57.01912911639111 -gcp 14340.0 16326.0 26.87038609060746 56.81180507268434 -gcp 0.0 16326.0 26.537029225919966 56.80986004438044 217-Lubana_1925.jpg 217-Lubana_1925.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e \"7215.75 1411.496876735147\n1870.5 1358.6247917823432\n1793.0625 7924.499895891172\n1727.25 14490.750416435316\n7102.125 14544.74750138812\n12477.375 14607.747084952804\n12574.5 1476.0\" | \ gdaltransform -tps -output_xy 217-Lubana_1925.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}'))))" \ 217-Lubana_1925.vrt 217-Lubana_1925.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES 217-Lubana_1925.cut.vrt 217-Lubana_1925.xyz