#!/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 1019.25 705.1540810660745 47.99820539 60.00018488 -gcp 12907.5 703.8739589117157 53.99835636 60.00026304 -gcp 13594.5 16462.87312604109 53.99853004 56.00018634 -gcp 316.5 16474.879789006107 47.99839502 56.00011147 -gcp 6960.375 827.6566490838422 50.99827852 60.00022482 -gcp 6954.5625 16607.122466685174 50.99846042 56.00014973 -gcp 3003.0 774.1447963800905 48.99996846 59.98167742 -gcp 4979.25 810.8793363499245 49.99687802 59.97180323 -gcp 10926.0 763.6900452488688 52.9968963 59.98429216 -gcp 8943.0 814.7156862745098 51.99582843 59.97068288 -gcp 13078.5 4641.709653092006 53.99807639 58.95958147 -gcp 13242.0 8580.337858220211 53.9942168 57.94638266 -gcp 13419.0 12521.695324283559 53.9967778 56.95982079 -gcp 11383.5 16536.34766214178 52.99791689 55.98301798 -gcp 9169.5 16588.874057315235 51.99725649 55.97088687 -gcp 4743.0 16593.377073906486 49.99860795 55.9707485 -gcp 2535.0 16551.355957767722 49.00139823 55.98129515 -gcp 489.75 12531.242458521872 47.99719613 56.95963851 -gcp 663.75 8592.921568627451 47.99640145 57.94472829 -gcp 838.875 4645.187971342382 47.99590714 58.95957586 -gcp 6954.375 8719.601809954751 50.99503611 57.9118396 -gcp 6958.5 4772.322963800905 50.99600383 58.9260006 -gcp 9050.25 8704.733408748114 51.9937028 57.91534876 -gcp 6951.75 12667.246229260934 50.99481591 56.92500484 -gcp 4856.25 8705.669683257918 49.99549421 57.91563013 vlasenko/north/o-39.jpg o-39.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "1019.25 705.1540810660745\n12907.5 703.8739589117157\n13594.5 16462.87312604109\n316.5 16474.879789006107" | \ gdaltransform -tps -output_xy o-39.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ o-39.vrt o-39.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES o-39.cut.vrt o-39.xyz