#!/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 609.0 702.0 27.5 56 -gcp 5430.0 723.0 28.166666666666668 56 -gcp 5451.0 5073.0 28.166666666666668 55.666666666666664 -gcp 582.0 5055.0 27.5 55.666666666666664 2_izdevums/59_Indra.jpg 59_Indra.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "607.5 702.9834087481147\n583.5 5517.043740573152\n5798.25 5531.257164404224\n5811.75 722.2405731523379" | \ gdaltransform -tps -output_xy 59_Indra.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ 59_Indra.vrt 59_Indra.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES 59_Indra.cut.vrt 59_Indra.xyz