#!/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 834.0 375.0 27 56.983333333333334 -gcp 11619.0 267.0 28.5 56.983333333333334 -gcp 11919.0 13137.0 28.5 56 -gcp 840.0 13275.0 27 56 45_Rezekne_1935.jpg 45_Rezekne_1935.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e \"837.0 162.0\n840.75 13275.375208217656\n11918.25 13143.37687395891\n11616.375295508275 55.87437534702943\" | \ gdaltransform -tps -output_xy 45_Rezekne_1935.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}'))))" \ 45_Rezekne_1935.vrt 45_Rezekne_1935.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES 45_Rezekne_1935.cut.vrt 45_Rezekne_1935.xyz