#!/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 1034.25 816.8390052356021 -6.00192032 55.99927699 -gcp 14295.0 799.8647469458988 -0.00197134 55.99937174 -gcp 15000.0 16573.88132635253 -0.00179093 51.99933351 -gcp 391.5 16615.89965095986 -6.00174458 51.99924339 -gcp 3247.5 892.5374791782343 -5.0019303 55.9992926 -gcp 5455.125 940.5483064963909 -4.0019397 55.99930829 -gcp 7661.25 948.1111882287619 -3.0019485 55.99932406 -gcp 9872.25 930.0991116046641 -2.00195671 55.99933989 -gcp 12085.875 878.3043448084399 -1.00196432 55.99935579 -gcp 14464.5 4740.97862298723 -0.00192201 54.99936193 -gcp 14639.25 8686.236812881732 -0.00187565 53.99935228 -gcp 14820.75 12624.95134647418 -0.00183203 52.99934281 -gcp 12568.5 16664.753886729595 -1.00178455 51.99931833 -gcp 10134.0 16719.49305941144 -2.00177764 51.99930321 -gcp 7693.5 16742.45988339811 -3.00177018 51.99928815 -gcp 5245.5 16734.952387562465 -4.00176218 51.99927316 -gcp 2826.75 16689.944058856192 -5.00175365 51.99925823 -gcp 550.125 12666.86202109939 -6.00178462 52.99925149 -gcp 712.875 8716.941837867851 -6.00182711 53.99925979 -gcp 873.75 4768.516240977235 -6.00187227 54.99926829 -gcp 7675.5 8856.110771793448 -3.00185392 53.99930573 -gcp 9999.75 8827.604525263741 -2.00186173 53.99932119 -gcp 7667.25 4904.6277068295385 -3.00189974 54.9993148 -gcp 5349.0 8844.78768739589 -4.00184555 53.99929034 -gcp 7682.25 12802.931843420323 -3.0018108 52.99929685 vlasenko/north/n-30.jpg n-30.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "1034.25 815.9746945898779\n14295.0 799.8647469458988\n15000.0 16573.88132635253\n391.5 16615.89965095986" | \ gdaltransform -tps -output_xy n-30.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ n-30.vrt n-30.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES n-30.cut.vrt n-30.xyz