#!/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 1176.0 1620.0 25.6084 55.9133 -gcp 21810.0 1599.0 26.789983333333332 55.94805 -gcp 21891.0 16320.0 26.836 55.47593333333333 -gcp 1320.0 16572.0 25.666816666666666 55.43803333333334 1915_3verst_ru_126k/11-5.jpg 11-5.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "1272.0 9111.758745141587\n1176.0 1620.0\n11490.0 1592.2404219877844\n21810.0 1599.0\n21891.0 16320.0\n11602.5 16426.489172681846\n1320.0 16572.0" | \ gdaltransform -tps -output_xy 11-5.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ 11-5.vrt 11-5.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES 11-5.cut.vrt 11-5.xyz