#!/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.29287719726563 56.68248947759268 -gcp 10506.0 0.0 21.292378306388855 56.65526818226212 -gcp 10506.0 11982.0 21.23618066310883 56.65554535786317 -gcp 0.0 11982.0 21.236781477928165 56.68263975175256 Aizpute-1988-991/Aizpute-1988-991-121.jpg Aizpute-1988-991-121.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "177.0 900.0\n10041.0 663.0\n10278.0 10560.0\n420.0 10806.0" | \ gdaltransform -tps -output_xy Aizpute-1988-991-121.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-121.vrt Aizpute-1988-991-121.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-121.cut.vrt Aizpute-1988-991-121.xyz