#!/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 936.0 1449.0 24.026666666666667 57 -gcp 10641.0 1455.0 24.476666666666667 57 -gcp 10692.0 11388.0 24.476666666666667 56.75 -gcp 933.0 11421.0 24.026666666666667 56.75 Bruno/IV-16_Riga.jpg IV-16_Riga.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "936.0 1449.0\n10641.0 1455.0\n10692.0 11388.0\n933.0 11421.0" | \ gdaltransform -tps -output_xy IV-16_Riga.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ IV-16_Riga.vrt IV-16_Riga.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES IV-16_Riga.cut.vrt IV-16_Riga.xyz