#!/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 1350.0 1560.0 27.812216666666668 58.346266666666665 -gcp 21924.0 1545.0 29.068483333333333 58.3633 -gcp 21861.0 16452.0 29.086766666666666 57.8924 -gcp 1305.0 16230.0 27.84665 57.871916666666664 1915_3verst_ru_126k/6-7.jpg 6-7.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "1308.0 8899.502498611882\n1350.0 1560.0\n11643.0 1572.0108273181565\n21924.0 1545.0\n21903.0 9006.004164353137\n21861.0 16452.0\n11579.625 16304.604802887283\n1305.0 16230.0" | \ gdaltransform -tps -output_xy 6-7.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ 6-7.vrt 6-7.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES 6-7.cut.vrt 6-7.xyz