#!/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.431521045161 56.535064437071 -gcp 10509.0 0.0 21.432121396065 56.508069268744 -gcp 10509.0 12648.0 21.373757777669 56.507952797695 -gcp 0.0 12648.0 21.373325382658 56.534710687232 Aizpute-1988-991/Aizpute-1988-991-22.jpg Aizpute-1988-991-22.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "192.0 1404.0\n447.0 11211.0\n10290.0 10920.0\n9940.5 1035.0" | \ gdaltransform -tps -output_xy Aizpute-1988-991-22.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-22.vrt Aizpute-1988-991-22.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-22.cut.vrt Aizpute-1988-991-22.xyz