#!/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.300753484483 56.620606015601 -gcp 11352.0 0.0 21.30563378334 56.591643815693 -gcp 11352.0 12660.0 21.247097772934 56.58856891146 -gcp 0.0 12660.0 21.242087340995 56.617593630463 Aizpute-1988-991/Aizpute-1988-991-71.jpg Aizpute-1988-991-71.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "1173.0 1098.0\n11022.75 1725.75\n10392.0 11607.0\n516.0 10965.0" | \ gdaltransform -tps -output_xy Aizpute-1988-991-71.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-71.vrt Aizpute-1988-991-71.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-71.cut.vrt Aizpute-1988-991-71.xyz