#!/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.56299522421586 56.68372447404859 -gcp 11565.0 0.0 21.56858700150794 56.654551813786625 -gcp 11565.0 12732.0 21.51021344651681 56.65105628284114 -gcp 0.0 12732.0 21.5048684324541 56.680249548663895 Aizpute-1988-991/Aizpute-1988-991-110.jpg Aizpute-1988-991-110.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "1443.0 624.0\n11280.0 1356.0\n10545.0 11229.0\n703.5 10504.5" | \ gdaltransform -tps -output_xy Aizpute-1988-991-110.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-110.vrt Aizpute-1988-991-110.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-110.cut.vrt Aizpute-1988-991-110.xyz