#!/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 1825.125 270.4191421432538 83.99621204 80.00091887 -gcp 10029.75 240.45204053303723 108.000783 80.00095927 -gcp 11691.9375 7989.426429761244 108.00056207 76.00088897 -gcp 255.375 8035.739658523042 83.99864051 76.00084917 -gcp 5929.875 679.936215991116 95.99943215 80.00096313 -gcp 5978.25 8593.298445308163 95.99959238 76.00089279 -gcp 5942.625 2656.587659633537 95.99948322 79.00094598 -gcp 5955.375 4634.73368961688 95.99952572 78.00092854 -gcp 5965.875 6614.792406996114 95.99956164 77.00091081 -gcp 7599.375 4573.777970571905 99.99990194 78.00093261 -gcp 4309.125 4585.184133814548 91.99915181 78.00091914 -gcp 1433.4375 2209.5440380344253 83.99827643 79.00090187 -gcp 1040.625 4149.242469461411 83.99841819 78.00088458 -gcp 646.5 6093.424139367018 83.99853798 77.00086701 -gcp 11276.0625 6051.603831204886 108.00060446 77.00090698 -gcp 10443.75 2175.8145474736257 108.00071259 79.00094213 -gcp 10860.0 4112.303616046641 108.00065398 78.0009247 -gcp 8674.875 480.4462104386452 104.00033361 80.00096594 -gcp 7303.875 625.1964186563021 99.9998826 80.00096723 -gcp 4556.25 636.4464186563021 91.99898447 80.00095368 -gcp 3181.6875 499.72216823986673 87.99854174 80.0009389 -gcp 2148.375 8347.998681288173 87.99895322 76.0008689 -gcp 4059.75 8535.987159911161 91.99927102 76.00088347 -gcp 7891.5 8524.97702665186 99.99991572 76.00089682 -gcp 9801.5625 8324.476228484174 104.00023948 76.00089555 vlasenko/north/t-45_46_47_48.jpg t-45_46_47_48.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "1825.125 270.4191421432538\n10029.75 240.45204053303723\n11691.9375 7989.426429761244\n255.375 8035.739658523042" | \ gdaltransform -tps -output_xy t-45_46_47_48.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ t-45_46_47_48.vrt t-45_46_47_48.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES t-45_46_47_48.cut.vrt t-45_46_47_48.xyz