#!/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 1275.75 607.5845363686841 23.99804261 55.9997597 -gcp 14536.5 831.9998611882287 29.99810041 55.9998536 -gcp 14925.0 16602.94280955025 29.99827426 51.99979183 -gcp 337.5 16367.386174347583 23.99822175 51.99970251 -gcp 3484.5 718.6082731815658 24.99805077 55.99977553 -gcp 5688.0 803.363686840644 25.99805952 55.9997913 -gcp 7893.75 849.0882842865076 26.99806887 55.999807 -gcp 10110.0 878.3674347584674 27.9980788 55.99982262 -gcp 12326.625 871.5367504164353 28.99808931 55.99983815 -gcp 14629.6875 4776.446210438645 29.99814795 54.99983812 -gcp 14727.0 8720.008675735702 29.99819262 53.99982266 -gcp 14827.125 12662.891206274293 29.99823465 52.99980723 -gcp 12496.5 16656.508883953356 28.99826418 51.99977713 -gcp 10060.5 16662.547196002222 27.99825462 51.99976236 -gcp 7629.0 16635.532204330928 26.9982456 51.9997475 -gcp 5202.0 16580.010549694613 25.99823711 51.99973257 -gcp 2779.5 16496.019711271514 24.99822916 51.99971757 -gcp 571.5 12431.45863409217 23.99818094 52.99971672 -gcp 805.5 8496.166157690172 23.99813763 53.99973099 -gcp 1037.25 4551.937395891171 23.9980916 54.99974532 -gcp 7758.0 8744.347237645752 26.9981626 53.99977717 -gcp 10081.5 8771.403664630761 27.99817205 53.99979241 -gcp 7690.5 12691.011521377011 26.99820534 52.99976231 -gcp 5443.5 8697.102443087173 25.99815371 53.99976185 -gcp 7822.5 4796.292892837313 26.99811719 54.99979207 vlasenko/north/n-35.jpg n-35.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "1275.75 607.5845363686841\n14536.5 831.9998611882287\n14925.0 16602.94280955025\n337.5 16367.386174347583" | \ gdaltransform -tps -output_xy n-35.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ n-35.vrt n-35.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES n-35.cut.vrt n-35.xyz