#!/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 2871.0 2499.0 26.743133333333333 56.423116666666665 -gcp 43368.0 2397.0 27.939783333333335 56.44968333333333 -gcp 43341.0 31836.0 27.96998333333333 55.976483333333334 -gcp 2865.0 31953.0 26.789983333333332 55.94805 1880_3vers_ru_126k/VTK_Ryad_X_List_6_1867.jpg VTK_Ryad_X_List_6_1867.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "2871.75 17237.256246529705\n2871.0 2499.0\n23121.0 2441.9966685174904\n43368.0 2397.0\n43323.0 17127.005830094393\n43341.0 31836.0\n23101.5 31893.749583564688\n2865.0 31953.0" | \ gdaltransform -tps -output_xy VTK_Ryad_X_List_6_1867.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ VTK_Ryad_X_List_6_1867.vrt VTK_Ryad_X_List_6_1867.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES VTK_Ryad_X_List_6_1867.cut.vrt VTK_Ryad_X_List_6_1867.xyz