#!/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 714.0 708.0 27.5 57.666666666666664 -gcp 5334.0 717.0 28.166666666666668 57.666666666666664 -gcp 5361.0 5067.0 28.166666666666668 57.333333333333336 -gcp 705.0 5052.0 27.5 57.333333333333336 2_izdevums/54_Liepna.jpg 54_Liepna.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "1206.0 251.99849170437392\n1191.0 2273.041478129713\n235.5 2269.5671191553547\n249.0 5057.264705882353\n5815.5 5072.248114630467\n5820.0 251.77224736048254" | \ gdaltransform -tps -output_xy 54_Liepna.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ 54_Liepna.vrt 54_Liepna.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES 54_Liepna.cut.vrt 54_Liepna.xyz