#!/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 990.75 797.3278734036646 29.99787597 59.99991567 -gcp 12867.0 742.8339811215991 35.99796387 60.00001024 -gcp 13647.0 16489.901443642422 35.99817902 55.99994419 -gcp 369.0 16570.922265408106 29.99810041 55.9998536 -gcp 6936.0 895.1464464186563 32.99791707 59.99996346 -gcp 7010.625 16675.60660744031 32.99813717 55.99989937 -gcp 2979.0 856.7073906485671 31.00226711 59.98157925 -gcp 4957.5 883.7435897435898 32.00093498 59.97191784 -gcp 8919.0 871.8242835595777 34.0007266 59.97026204 -gcp 10899.0 816.1644042232278 35.00161749 59.98275473 -gcp 13054.5 4669.8657616892915 35.9945748 58.9606236 -gcp 13253.25 8609.380844645551 35.99645184 57.94615776 -gcp 13447.875 12545.035633484164 35.9963994 56.96050956 -gcp 11433.75 16579.941176470587 34.9957876 55.9815701 -gcp 9219.75 16635.426847662144 33.99482076 55.97149621 -gcp 4798.5 16659.4649321267 31.99851335 55.9721825 -gcp 2588.25 16622.72209653092 31.00059539 55.98420749 -gcp 528.75 12623.369155354449 29.99997246 56.95933278 -gcp 683.25 8682.879336349924 29.99957952 57.94446285 -gcp 837.0 4740.192307692308 29.99875389 58.95801257 -gcp 6972.0 8781.865761689292 32.99759647 57.91088142 -gcp 6951.75 4839.875188536953 32.9974064 58.9241506 -gcp 9069.75 8752.93363499246 33.99779456 57.91538289 -gcp 6993.0 12721.130467571646 32.99813038 56.92614747 -gcp 4878.0 8785.99057315234 31.99972357 57.91266401 vlasenko/north/o-36.jpg o-36.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "990.75 797.3278734036646\n12867.0 742.8339811215991\n13647.0 16489.901443642422\n369.0 16570.922265408106" | \ gdaltransform -tps -output_xy o-36.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ o-36.vrt o-36.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES o-36.cut.vrt o-36.xyz