#!/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 1365.0 1719.0 22.0042 56.20791666666667 -gcp 21864.0 1812.0 23.18235 56.2773 -gcp 21882.0 16443.0 23.270033333333334 55.803716666666666 -gcp 1419.0 16551.0 22.1088 55.73328333333333 1915_3verst_ru_126k/10-2.jpg 10-2.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "1365.0 1719.0\n11640.75 1753.4933370349806\n12279.0 1780.5491393670184\n21864.0 1812.0\n21855.0 9186.03248195447\n21882.0 16443.0\n11740.5 16488.001665741256\n1419.0 16551.0" | \ gdaltransform -tps -output_xy 10-2.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ 10-2.vrt 10-2.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES 10-2.cut.vrt 10-2.xyz