#!/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.3419973203211 56.659663324596 -gcp 10500.0 0.0 21.3422717384929 56.6333485198147 -gcp 10500.0 12180.0 21.2865880073821 56.6342294066786 -gcp 0.0 12180.0 21.2863135892103 56.6605442114599 Aizpute-1988-991/Aizpute-1988-991-100.jpg Aizpute-1988-991-100.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "207.0 1089.0\n630.0 10974.0\n10494.0 10533.0\n10020.0 645.0" | \ gdaltransform -tps -output_xy Aizpute-1988-991-100.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-100.vrt Aizpute-1988-991-100.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-100.cut.vrt Aizpute-1988-991-100.xyz