#!/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 633.0 690.0 24.833333333333332 56.333333333333336 -gcp 5412.0 708.0 25.5 56.333333333333336 -gcp 5427.0 5067.0 25.5 56 -gcp 609.0 5043.0 24.833333333333332 56 2_izdevums/34_Nereta.jpg 34_Nereta.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "241.875 692.2533936651583\n237.75 5503.504524886877\n5799.0 5527.878959276019\n5811.0 707.9954751131222" | \ gdaltransform -tps -output_xy 34_Nereta.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ 34_Nereta.vrt 34_Nereta.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES 34_Nereta.cut.vrt 34_Nereta.xyz