#!/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 3258.0 3159.0 27.939783333333335 56.44968333333333 -gcp 44301.0 3060.0 29.1317 56.465333333333334 -gcp 44352.0 32523.0 29.14655 55.99118333333333 -gcp 3267.0 32535.0 27.96998333333333 55.976483333333334 1880_3vers_ru_126k/VTK_Ryad_X_List_7_1867.jpg VTK_Ryad_X_List_7_1867.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "3271.5 17854.504164353137\n3258.0 3159.0\n23776.5 3135.0141588006663\n44301.0 3060.0\n44343.0 17800.504997223765\n44352.0 32523.0\n23809.5 32538.00499722376\n3267.0 32535.0" | \ gdaltransform -tps -output_xy VTK_Ryad_X_List_7_1867.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ VTK_Ryad_X_List_7_1867.vrt VTK_Ryad_X_List_7_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_7_1867.cut.vrt VTK_Ryad_X_List_7_1867.xyz