#!/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 1257.0 1647.0 27.84665 57.871916666666664 -gcp 21957.0 1542.0 29.086766666666666 57.8924 -gcp 22062.0 16449.0 29.101583333333334 57.41471666666666 -gcp 1290.0 16326.0 27.87815 57.39706666666667 1915_3verst_ru_126k/7-7.jpg 7-7.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "1289.625 8995.504997223765\n1257.0 1647.0\n11607.0 1599.0024986118822\n21957.0 1542.0\n21996.0 9003.004164353137\n22062.0 16449.0\n11672.25 16420.143114936145\n1290.0 16326.0" | \ gdaltransform -tps -output_xy 7-7.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ 7-7.vrt 7-7.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES 7-7.cut.vrt 7-7.xyz