#!/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 1332.0 1518.0 24.373166666666666 56.33838333333333 -gcp 21780.0 1665.0 25.549733333333332 56.38473333333334 -gcp 21795.0 16362.0 25.6084 55.9133 -gcp 1314.0 16383.0 24.451366666666665 55.86213333333333 1915_3verst_ru_126k/10-4.jpg 10-4.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "1326.75 8952.75124930594\n1332.0 1518.0\n11586.0 1622.2670738478623\n21780.0 1665.0\n21800.25 9020.253747917825\n21795.0 16362.0\n11550.75 16364.995835646861\n1314.0 16383.0" | \ gdaltransform -tps -output_xy 10-4.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ 10-4.vrt 10-4.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES 10-4.cut.vrt 10-4.xyz