#!/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.262174032902042 56.5341644799049 -gcp 10512.0 0.0 21.262181997299198 56.50721672516955 -gcp 10512.0 12111.0 21.20626690469397 56.50708896442578 -gcp 0.0 12111.0 21.206117784425242 56.53412316008831 Aizpute-1988-991/Aizpute-1988-991-15.jpg Aizpute-1988-991-15.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "0.0 781.5\n13.5 4317.0\n244.5 10681.5\n10126.5 10287.0\n9720.0 378.0" | \ gdaltransform -tps -output_xy Aizpute-1988-991-15.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-15.vrt Aizpute-1988-991-15.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-15.cut.vrt Aizpute-1988-991-15.xyz