#!/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 4416.0 3363.0 23.18235 56.2773 -gcp 44733.0 2847.0 24.373166666666666 56.33838333333333 -gcp 45036.0 32172.0 24.451366666666665 55.86213333333333 -gcp 4722.0 32727.0 23.270033333333334 55.803716666666666 1880_3vers_ru_126k/VTK_Ryad_X_List_3_1861.jpg VTK_Ryad_X_List_3_1861.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "4566.0 18046.500832870628\n4416.0 3363.0\n24574.5 3079.4858411993337\n44733.0 2847.0\n44872.5 17521.50666296502\n45036.0 32172.0\n24873.75 32469.76124375347\n4722.0 32727.0" | \ gdaltransform -tps -output_xy VTK_Ryad_X_List_3_1861.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ VTK_Ryad_X_List_3_1861.vrt VTK_Ryad_X_List_3_1861.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES VTK_Ryad_X_List_3_1861.cut.vrt VTK_Ryad_X_List_3_1861.xyz