#!/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.319636281898 56.596177111297 -gcp 11442.0 0.0 21.31519317627 56.566824910158 -gcp 11442.0 12843.0 21.255948543549 56.569585341151 -gcp 0.0 12843.0 21.260497570038 56.598944562676 Aizpute-1988-991/Aizpute-1988-991-68.jpg Aizpute-1988-991-68.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "510.0 6615.0\n61.5 1590.0\n9765.0 528.0\n10827.0 10407.0\n1017.0 11451.0" | \ gdaltransform -tps -output_xy Aizpute-1988-991-68.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-68.vrt Aizpute-1988-991-68.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-68.cut.vrt Aizpute-1988-991-68.xyz