#!/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.531136501048426 57.51711180000529 -gcp 14340.0 0.0 26.870636234743035 57.518561576262634 -gcp 14340.0 16323.0 26.871519564604192 57.3113657108741 -gcp 0.0 16323.0 26.534574936548132 57.31015228783729 214-Zeltini_1924.jpg 214-Zeltini_1924.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e \"7209.0 1385.2429205996668\n1912.5 1356.0\n1846.3125 7934.628747917824\n1807.5 14499.743753470295\n7125.0 14533.873542476402\n12438.0 14573.624791782344\n12460.875 8007.000208217658\n12480.0 1440.0\" | \ gdaltransform -tps -output_xy 214-Zeltini_1924.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}'))))" \ 214-Zeltini_1924.vrt 214-Zeltini_1924.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES 214-Zeltini_1924.cut.vrt 214-Zeltini_1924.xyz