#!/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.365468502045 56.598997718282 -gcp 11235.0 0.0 21.36815071106 56.569910432184 -gcp 11235.0 12948.0 21.308187246323 56.568485921683 -gcp 0.0 12948.0 21.305365562439 56.597089975821 Aizpute-1988-991/Aizpute-1988-991-66.jpg Aizpute-1988-991-66.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "877.5 1242.0\n10746.0 1506.0\n10467.0 11427.0\n598.5 11151.0" | \ gdaltransform -tps -output_xy Aizpute-1988-991-66.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-66.vrt Aizpute-1988-991-66.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-66.cut.vrt Aizpute-1988-991-66.xyz