#!/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 972.0 1332.0 23.18235 56.2773 -gcp 21453.0 1515.0 24.373166666666666 56.33838333333333 -gcp 21510.0 16218.0 24.451366666666665 55.86213333333333 -gcp 900.0 16269.0 23.270033333333334 55.803716666666666 1915_3verst_ru_126k/10-3.jpg 10-3.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "960.0 8808.0\n972.0 1332.0\n11212.125 1422.0\n21453.0 1515.0\n21452.625 6655.875\n21459.0 12018.0\n21510.0 16218.0\n11205.75 16251.75\n900.0 16269.0" | \ gdaltransform -tps -output_xy 10-3.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ 10-3.vrt 10-3.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES 10-3.cut.vrt 10-3.xyz