#!/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 1368.0 1653.0 21 58 -gcp 17031.0 1788.0 22.5 58 -gcp 17058.0 21447.0 22.5 57 -gcp 969.0 21279.0 21 57 31_Ventspils_1940.jpg 31_Ventspils_1940.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e \"852.0 1650.0\n432.0 21273.0\n17058.0 21447.0\n17031.0 1788.0\" | \ gdaltransform -tps -output_xy 31_Ventspils_1940.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}'))))" \ 31_Ventspils_1940.vrt 31_Ventspils_1940.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES 31_Ventspils_1940.cut.vrt 31_Ventspils_1940.xyz