#!/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.483700275421 56.619628256076 -gcp 10596.0 0.0 21.485298871994 56.592459017593 -gcp 10596.0 12456.0 21.428017616272 56.59123030076 -gcp 0.0 12456.0 21.425796747208 56.618117070934 Aizpute-1988-991/Aizpute-1988-991-79.jpg Aizpute-1988-991-79.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "273.0 1086.0\n10131.0 1086.0\n10134.0 10977.0\n234.0 10962.0" | \ gdaltransform -tps -output_xy Aizpute-1988-991-79.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-79.vrt Aizpute-1988-991-79.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-79.cut.vrt Aizpute-1988-991-79.xyz