#!/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 2736.0 3081.0 25.549733333333332 56.38473333333334 -gcp 44310.0 3198.0 26.743133333333333 56.423116666666665 -gcp 44097.0 32883.0 26.789983333333332 55.94805 -gcp 2685.0 32787.0 25.6084 55.9133 1880_3vers_ru_126k/VTK_Ryad_X_List_5_1877.jpg VTK_Ryad_X_List_5_1877.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "2708.25 17937.001665741256\n2736.0 3081.0\n23526.0 3109.4833425874513\n44310.0 3198.0\n44197.5 18048.004164353137\n44097.0 32883.0\n23391.0 32829.7470849528\n2685.0 32787.0" | \ gdaltransform -tps -output_xy VTK_Ryad_X_List_5_1877.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ VTK_Ryad_X_List_5_1877.vrt VTK_Ryad_X_List_5_1877.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES VTK_Ryad_X_List_5_1877.cut.vrt VTK_Ryad_X_List_5_1877.xyz