#!/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 517.5 1311.8207940033315 27 56.66666667 -gcp 6497.25 1318.691143808995 27.5 56.66666667 -gcp 6482.249679878507 8860.571660302594 27.5 56.33333333 -gcp 441.75 8820.164908384231 27 56.33333333 001/kopijas/O-35-127.jpg O-35-127.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "517.5 1311.8207940033315\n6497.25 1318.691143808995\n6482.249679878507 8860.571660302594\n441.75 8820.164908384231" | \ gdaltransform -tps -output_xy O-35-127.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ O-35-127.vrt O-35-127.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES O-35-127.cut.vrt O-35-127.xyz