#!/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 705.0 708.0 24.833333333333332 57.333333333333336 -gcp 5367.0 705.0 25.5 57.333333333333336 -gcp 5400.0 5043.0 25.5 57 -gcp 702.0 5049.0 24.833333333333332 57 2_izdevums/31_Cesis.jpg 31_Cesis.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "705.0 708.0\n5367.0 705.0\n5400.0 5043.0\n702.0 5049.0" | \ gdaltransform -tps -output_xy 31_Cesis.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ 31_Cesis.vrt 31_Cesis.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES 31_Cesis.cut.vrt 31_Cesis.xyz