#!/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.437265872955 56.618813640351 -gcp 10518.0 0.0 21.438564062119 56.591998253462 -gcp 10518.0 12267.0 21.382151842117 56.590929022746 -gcp 0.0 12267.0 21.380274295807 56.617821910524 Aizpute-1988-991/Aizpute-1988-991-77.jpg Aizpute-1988-991-77.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "150.0 1002.0\n10011.0 753.0\n10266.0 10656.0\n366.0 10887.0" | \ gdaltransform -tps -output_xy Aizpute-1988-991-77.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-77.vrt Aizpute-1988-991-77.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-77.cut.vrt Aizpute-1988-991-77.xyz