#!/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 1386.0 1683.0 20.710266666666666 56.59578333333333 -gcp 22140.0 1794.0 21.898233333333334 56.677033333333334 -gcp 22191.0 16434.0 22.0042 56.20791666666667 -gcp 1392.0 16509.0 20.8318 56.12565 1915_3verst_ru_126k/9-1.jpg 9-1.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "1396.5 9103.504164353137\n1386.0 1683.0\n11764.5 1753.5083287062744\n22140.0 1794.0\n22134.0 9132.00999444753\n22191.0 16434.0\n11776.5 16500.015824541922\n1392.0 16509.0" | \ gdaltransform -tps -output_xy 9-1.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ 9-1.vrt 9-1.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES 9-1.cut.vrt 9-1.xyz