#!/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 656.25 1027.6374236535257 17.99800626 55.9996635 -gcp 13911.75 864.1461687951139 23.99804261 55.9997597 -gcp 14839.5 16561.90477512493 23.99822175 51.99970251 -gcp 265.5 16758.483897834536 17.99818873 51.99961101 -gcp 2877.0 1079.336202109939 18.99801081 55.99967964 -gcp 5088.75 1098.8616046640755 19.99801597 55.99969575 -gcp 7296.0 1088.349528039978 20.99802173 55.99971182 -gcp 9507.75529411112 1041.8494125289776 21.99802809 55.99972783 -gcp 11708.25 963.1107717934481 22.99803505 55.99974379 -gcp 14151.0 4783.75569128262 23.9980916 54.99974532 -gcp 14379.75 8714.496946141033 23.99813763 53.99973099 -gcp 14610.0 12634.735702387561 23.99818094 52.99971672 -gcp 12415.5 16687.151860077734 22.99821488 51.99968738 -gcp 9990.0 16770.520544142142 21.99820856 51.9996722 -gcp 7554.0 16822.996182676292 20.99820277 51.99965697 -gcp 5117.25 16839.476193781233 19.99819754 51.99964169 -gcp 2691.0 16813.590574680733 18.99819286 51.99962637 -gcp 364.875 12826.542684619655 17.99814716 52.999624 -gcp 462.0 8904.980705163798 17.99810304 53.99963708 -gcp 561.75 4959.856815657968 17.99805615 54.99965025 -gcp 7431.75 8950.843559133815 20.99811775 53.99968425 -gcp 7363.5 5017.000277623542 20.99807123 54.999698 -gcp 9755.25 8904.530330372016 21.99812381 53.99969989 -gcp 7492.5 12880.996390893948 20.99816153 52.99967057 -gcp 5105.8125 8973.224770960576 19.99811227 53.99966857 vlasenko/north/n-34.jpg n-34.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "656.25 1027.6374236535257\n13911.75 864.1461687951139\n14839.5 16561.90477512493\n265.5 16758.483897834536" | \ gdaltransform -tps -output_xy n-34.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ n-34.vrt n-34.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES n-34.cut.vrt n-34.xyz