#!/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 1350.0 1554.0 32.841433333333335 58.34721666666667 -gcp 21915.0 1395.0 34.0956 58.3197 -gcp 21948.0 16299.0 34.0498 57.843583333333335 -gcp 1377.0 16239.0 32.810833333333335 57.87355 1915_3verst_ru_126k/6-11.jpg 6-11.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "1356.0 8906.255413659077\n1350.0 1554.0\n11632.5 1483.5049972237648\n21915.0 1395.0\n21940.5 8853.00333148251\n21948.0 16299.0\n11662.5 16261.495835646861\n1377.0 16239.0" | \ gdaltransform -tps -output_xy 6-11.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ 6-11.vrt 6-11.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES 6-11.cut.vrt 6-11.xyz