#!/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 1143.0 1473.0 26.743133333333333 56.423116666666665 -gcp 21879.0 1701.0 27.939783333333335 56.44968333333333 -gcp 21801.0 16416.0 27.96998333333333 55.976483333333334 -gcp 1065.0 16368.0 26.789983333333332 55.94805 1915_3verst_ru_126k/10-6.jpg 10-6.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "1105.875 8923.876873958912\n1143.0 1473.0\n11503.5 1612.5141588006663\n21879.0 1701.0\n21841.5 9062.252082176568\n21801.0 16416.0\n11689.125 16387.1356191005\n11522.25 16366.496668517491\n1065.0 16368.0" | \ gdaltransform -tps -output_xy 10-6.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ 10-6.vrt 10-6.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES 10-6.cut.vrt 10-6.xyz