#!/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.36566162109375 56.66036611814133 -gcp 10509.0 0.0 21.364084482192993 56.63334421673432 -gcp 10509.0 12276.0 21.30706071853638 56.63422342628267 -gcp 0.0 12276.0 21.30825161933899 56.66134493728235 Aizpute-1988-991/Aizpute-1988-991-101.jpg Aizpute-1988-991-101.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "336.0 807.0\n801.0 10696.5\n10506.0 10209.0\n10491.0 7044.0\n10164.0 318.0" | \ gdaltransform -tps -output_xy Aizpute-1988-991-101.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-101.vrt Aizpute-1988-991-101.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-101.cut.vrt Aizpute-1988-991-101.xyz