#!/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.553877592087 56.619102889976 -gcp 10539.0 0.0 21.554403305054 56.592305430173 -gcp 10539.0 12501.0 21.497320532799 56.591587696074 -gcp 0.0 12501.0 21.496210098267 56.618335488151 Aizpute-1988-991/Aizpute-1988-991-82.jpg Aizpute-1988-991-82.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "15.0 1215.0\n9876.0 1011.0\n10089.0 10911.0\n190.5 11092.5" | \ gdaltransform -tps -output_xy Aizpute-1988-991-82.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-82.vrt Aizpute-1988-991-82.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-82.cut.vrt Aizpute-1988-991-82.xyz