#!/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 654.75 307.5666296501944 5.99776286 59.99951359 -gcp 8563.5 326.44780677401445 11.99775448 59.99961549 -gcp 9003.0 10833.963631315935 11.99799175 55.99956606 -gcp 165.75 10819.679483620212 5.99799925 55.99946845 -gcp 4604.25 404.2706135480289 8.99775559 59.99956449 -gcp 4587.375 10923.531579677958 8.99799275 55.99951721 -gcp 1974.0 358.92726263187114 6.99929034 59.98016935 -gcp 3288.0 389.6851749028318 7.99569041 59.96909525 -gcp 5925.75 390.44891726818435 9.99518286 59.97134508 -gcp 7243.875 370.5787062742921 10.99516022 59.98060315 -gcp 8669.25 2953.373820099944 11.9947751 58.95807576 -gcp 8778.5625 5579.895787062743 11.9945276 57.94464559 -gcp 8889.375 8205.561563020545 11.99536504 56.9590764 -gcp 7533.375 10883.862159911161 10.99869489 55.98073884 -gcp 6058.875 10913.087382009995 9.99752414 55.96935648 -gcp 3113.625 10908.055073570238 7.99953796 55.9694282 -gcp 1639.5 10876.709050527485 6.99922757 55.97982843 -gcp 288.75 8187.047473625764 5.99831821 56.96007038 -gcp 412.3125 5566.178928373126 5.99944967 57.94339262 -gcp 532.125 2937.8136104941696 5.9976269 58.95707655 -gcp 4595.8125 5664.466928095502 8.9964397 57.90924858 -gcp 4599.375 3034.5411229872293 8.99445346 58.92280746 -gcp 5993.8125 5653.9567254303165 9.99747332 57.91432142 -gcp 4591.5 8293.78026096613 8.99779534 56.92351862 -gcp 3202.875 5652.084224042199 7.99923648 57.9128823 vlasenko/north/o-32.jpg o-32.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "654.75 307.5666296501944\n8563.5 326.44780677401445\n9003.0 10833.963631315935\n165.75 10819.679483620212" | \ gdaltransform -tps -output_xy o-32.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ o-32.vrt o-32.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES o-32.cut.vrt o-32.xyz