#!/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 846.0 1596.0 23.093783333333334 56.74915 -gcp 21396.0 1746.0 24.295066666666667 56.80938333333334 -gcp 21426.0 16458.0 24.373166666666666 56.33838333333333 -gcp 777.0 16512.0 23.18235 56.2773 1915_3verst_ru_126k/9-3.jpg 9-3.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "828.0 9057.752082176568\n846.0 1596.0\n11124.0 1681.5058300943922\n21396.0 1746.0\n21419.25 9107.252915047196\n21426.0 16458.0\n11100.0 16466.99000555247\n777.0 16512.0" | \ gdaltransform -tps -output_xy 9-3.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ 9-3.vrt 9-3.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES 9-3.cut.vrt 9-3.xyz