#!/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 672.0 717.0 22.833333333333332 56.666666666666664 -gcp 5436.0 729.0 23.5 56.666666666666664 -gcp 5451.0 5073.0 23.5 56.333333333333336 -gcp 648.0 5049.0 22.833333333333332 56.333333333333336 2_izdevums/17_Dobele.jpg 17_Dobele.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "669.0 714.0\n642.9381588193957 5507.437187673515\n5454.0 5529.748750694059\n5442.0 726.0" | \ gdaltransform -tps -output_xy 17_Dobele.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ 17_Dobele.vrt 17_Dobele.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES 17_Dobele.cut.vrt 17_Dobele.xyz