#!/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.279251575469974 56.513166375350664 -gcp 10554.0 0.0 21.27876877784729 56.48628192907661 -gcp 10554.0 12183.0 21.222624778747562 56.48640632832223 -gcp 0.0 12183.0 21.22312903404236 56.51355706597162 Aizpute-1988-991/Aizpute-1988-991-13.jpg Aizpute-1988-991-13.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "312.0 891.0\n499.5 10785.0\n10353.0 10593.0\n10155.0 678.0" | \ gdaltransform -tps -output_xy Aizpute-1988-991-13.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ Aizpute-1988-991-13.vrt Aizpute-1988-991-13.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES Aizpute-1988-991-13.cut.vrt Aizpute-1988-991-13.xyz