#!/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 1572.0 1458.0 26.789983333333332 55.94805 -gcp 22122.0 1665.0 27.96998333333333 55.976483333333334 -gcp 22050.0 16452.0 28.0002 55.501216666666664 -gcp 1410.0 16344.0 26.836 55.47593333333333 1915_3verst_ru_126k/11-06.jpg 11-06.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "1485.375 8902.500832870628\n1572.0 1458.0\n11840.25 1582.886868406441\n22122.0 1665.0\n22094.25 9064.50333148251\n22050.0 16452.0\n11726.25 16414.5091615769\n1410.0 16344.0" | \ gdaltransform -tps -output_xy 11-06.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ 11-06.vrt 11-06.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES 11-06.cut.vrt 11-06.xyz