#!/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 1362.0 1611.0 25.490083333333335 56.85845 -gcp 21894.0 1698.0 26.69558333333333 56.89803333333333 -gcp 21888.0 16395.0 26.743133333333333 56.423116666666665 -gcp 1362.0 16491.0 25.549733333333332 56.38473333333334 1915_3verst_ru_126k/9-5.jpg 9-5.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "1368.0 9058.504164353137\n1362.0 1611.0\n11632.5 1643.9941699056078\n21894.0 1698.0\n21888.0 9052.50333148251\n21888.0 16395.0\n11628.0 16441.499167129372\n1362.0 16491.0" | \ gdaltransform -tps -output_xy 9-5.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ 9-5.vrt 9-5.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES 9-5.cut.vrt 9-5.xyz