#!/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 4092.0 3312.0 24.373166666666666 56.33838333333333 -gcp 44430.0 2775.0 25.549733333333332 56.38473333333334 -gcp 44796.0 32109.0 25.6084 55.9133 -gcp 4452.0 32667.0 24.451366666666665 55.86213333333333 1880_3vers_ru_126k/VTK_Ryad_X_List_4_1856.jpg VTK_Ryad_X_List_4_1856.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "4274.25 17994.00249861188\n4092.0 3312.0\n24268.5 3045.0008328706276\n44430.0 2775.0\n44607.0 17452.505830094393\n44796.0 32109.0\n24607.5 32412.76374236535\n4452.0 32667.0" | \ gdaltransform -tps -output_xy VTK_Ryad_X_List_4_1856.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ VTK_Ryad_X_List_4_1856.vrt VTK_Ryad_X_List_4_1856.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES VTK_Ryad_X_List_4_1856.cut.vrt VTK_Ryad_X_List_4_1856.xyz