#!/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 21.272996664047 56.659776455788 -gcp 11154.0 0.0 21.268608570099 56.631308384444 -gcp 11154.0 12285.0 21.211788654327 56.633721866299 -gcp 0.0 12285.0 21.215897798538 56.662359108615 Aizpute-1988-991/Aizpute-1988-991-97.jpg Aizpute-1988-991-97.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "258.0 1377.0\n1285.5 11233.5\n11069.25 10192.5\n11011.5 9273.0\n10050.0 339.0" | \ gdaltransform -tps -output_xy Aizpute-1988-991-97.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-97.vrt Aizpute-1988-991-97.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-97.cut.vrt Aizpute-1988-991-97.xyz