#!/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 741.0 705.0 24.166666666666668 58 -gcp 5313.0 735.0 24.833333333333332 58 -gcp 5328.0 5085.0 24.833333333333332 57.666666666666664 -gcp 708.0 5052.0 24.166666666666668 57.666666666666664 2_izdevums/22_Ainazi.jpg 22_Ainazi.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "5312.25 271.46153846153845\n2026.5 252.7443438914027\n243.0 239.24811463046757\n232.5 5055.742081447964\n5330.25 5088.744343891403" | \ gdaltransform -tps -output_xy 22_Ainazi.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ 22_Ainazi.vrt 22_Ainazi.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES 22_Ainazi.cut.vrt 22_Ainazi.xyz