#!/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.517496109008793 56.68134914237031 -gcp 10767.0 0.0 21.517968177795414 56.65405625224261 -gcp 10767.0 12207.0 21.461684586295142 56.65343398411252 -gcp 0.0 12207.0 21.460901394796906 56.68100894838249 Aizpute-1988-991/Aizpute-1988-991-112.jpg Aizpute-1988-991-112.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "495.0 861.0\n10359.0 864.0\n10350.0 10758.0\n489.0 10761.0" | \ gdaltransform -tps -output_xy Aizpute-1988-991-112.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-112.vrt Aizpute-1988-991-112.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-112.cut.vrt Aizpute-1988-991-112.xyz