#!/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.414595842361 56.618140683667 -gcp 10527.0 0.0 21.413952112198 56.59123030076 -gcp 10527.0 12261.0 21.357529163361 56.591248022922 -gcp 0.0 12261.0 21.357389688492 56.618229231284 Aizpute-1988-991/Aizpute-1988-991-76.jpg Aizpute-1988-991-76.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "111.0 945.0\n9969.0 459.0\n10467.75 10356.0\n570.0 10827.0" | \ gdaltransform -tps -output_xy Aizpute-1988-991-76.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-76.vrt Aizpute-1988-991-76.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-76.cut.vrt Aizpute-1988-991-76.xyz