#!/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.395289698593 56.641908127534 -gcp 11520.0 0.0 21.402752341754 56.612601580488 -gcp 11520.0 13125.0 21.342136458702 56.60765954481 -gcp 0.0 13125.0 21.334598713688 56.637025688062 Aizpute-1988-991/Aizpute-1988-991-90.jpg Aizpute-1988-991-90.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "1239.0 804.0\n11085.0 1830.0\n10044.0 11676.0\n210.0 10632.0" | \ gdaltransform -tps -output_xy Aizpute-1988-991-90.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-90.vrt Aizpute-1988-991-90.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-90.cut.vrt Aizpute-1988-991-90.xyz