#!/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 4108.875 1259.217934480844 59.9859011 84.00075865 -gcp 13949.25 1254.1848972792893 83.99685377 84.00098404 -gcp 17189.25 16812.056010549695 83.99810612 80.00091888 -gcp 858.5625 16830.431531093836 59.99575681 80.00069575 -gcp 5740.5 1549.6091060521933 63.993533 84.00080781 -gcp 7381.5 1722.275680177679 67.99414647 84.00085254 -gcp 9034.5 1782.3023320377567 71.99478847 84.00089271 -gcp 10683.0 1722.92490283176 75.99545587 84.00092813 -gcp 12325.5 1545.9032481954468 79.99614543 84.00095862 -gcp 14755.125 5146.203498056635 83.99730148 83.00096819 -gcp 15568.125 9033.24111604664 83.99763701 82.00095204 -gcp 16375.5 12921.54469739034 83.99789774 81.0009356 -gcp 14487.375 17290.680941143808 79.99767973 80.00089371 -gcp 11758.125 17577.108897834536 75.99726465 80.00086351 -gcp 9021.375 17676.853692393117 71.99686289 80.00082843 -gcp 6282.375 17583.478067740143 67.99647643 80.00078865 -gcp 3555.375 17302.740387284844 63.99610713 80.00074435 -gcp 1676.25 12937.732995558024 59.99528994 81.00071183 -gcp 2491.125 9046.172785952249 59.99470579 82.00072769 -gcp 3300.5625 5147.840713492505 59.99395409 83.00074333 -gcp 9030.0 5754.11993337035 71.99553007 83.00087704 -gcp 9027.0 9726.922404219877 71.99608584 82.0008611 -gcp 9025.5 13696.692393114936 71.99651772 81.0008449 -gcp 6834.75 9648.824750138812 67.99560365 82.0008211 -gcp 11221.5 9649.567462520823 75.9965871 82.00089637 vlasenko/north/u-41_42_43_44.jpg u-41_42_43_44.vrt # Add cutline to VRT gdalwarp -r $GDAL_SAMPLING_WARP -tps -dstalpha -cutline_srs EPSG:4326 \ -cutline "POLYGON(($(echo -e "4108.875 1259.217934480844\n13949.25 1254.1848972792893\n17189.25 16812.056010549695\n858.5625 16830.431531093836" | \ gdaltransform -tps -output_xy u-41_42_43_44.vrt | \ awk 'NR==1{first=$0} {printf "%s %s,", $1,$2} END{print " " first}')))" \ u-41_42_43_44.vrt u-41_42_43_44.cut.vrt # Generate tiles gdal2tiles.py -r $GDAL_SAMPLING_TILE --xyz -z $GDAL_TILE_ZOOMS -x --processes=$GDAL_TILE_PROCESSES u-41_42_43_44.cut.vrt u-41_42_43_44.xyz