#!/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.50047221627 56.540268249375 -gcp 11925.0 0.0 21.507954388024 56.509951003615 -gcp 11925.0 13269.0 21.447810850292 56.505238719503 -gcp 0.0 13269.0 21.439497193742 56.535348459599 Aizpute-1988-991/Aizpute-1988-991-25.jpg Aizpute-1988-991-25.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "1791.0 1020.0\n657.0 10851.0\n10470.75 11978.25\n11577.0 2115.0" | \ gdaltransform -tps -output_xy Aizpute-1988-991-25.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-25.vrt Aizpute-1988-991-25.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-25.cut.vrt Aizpute-1988-991-25.xyz