#!/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.03065701650996 57.51891839004133 -gcp 14340.0 0.0 27.370546129290275 57.51896755339004 -gcp 14340.0 16572.0 27.368527658637014 57.30893342220382 -gcp 0.0 16572.0 27.030878221367725 57.30911546588641 238-Beja_1923.jpg 238-Beja_1923.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e \"7215.75 1479.7454192115492\n1944.0 1488.0\n1938.1875 8072.626041088284\n1944.75 14653.500832870628\n7260.1875 14648.812604108829\n12555.0 14643.750416435316\n12529.875 8066.813020544141\n12500.8125 1488.0016657412548\" | \ gdaltransform -tps -output_xy 238-Beja_1923.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}'))))" \ 238-Beja_1923.vrt 238-Beja_1923.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES 238-Beja_1923.cut.vrt 238-Beja_1923.xyz