1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
| import GeoTIFF from 'ol/source/GeoTIFF.js'; import Map from 'ol/Map.js'; import TileLayer from 'ol/layer/WebGLTile.js';
const source = new GeoTIFF({ sources: [ { url: 'https://s2downloads.eox.at/demo/Sentinel-2/3857/R10m.tif', bands: [3, 4], min: 0, nodata: 0, max: 65535, }, { url: 'https://s2downloads.eox.at/demo/Sentinel-2/3857/R60m.tif', bands: [9], min: 0, nodata: 0, max: 65535, }, ], }); source.setAttributions( "<a href='https://s2maps.eu'>Sentinel-2 cloudless</a> by <a href='https://eox.at/'>EOX IT Services GmbH</a> (Contains modified Copernicus Sentinel data 2019)" );
const ndvi = [ '/', ['-', ['band', 2], ['band', 1]], ['+', ['band', 2], ['band', 1]], ];
const ndwi = [ '/', ['-', ['band', 3], ['band', 1]], ['+', ['band', 3], ['band', 1]], ];
const map = new Map({ target: 'map', layers: [ new TileLayer({ style: { color: [ 'color', ['*', 255, ['abs', ['-', ndvi, ndwi]]], ['*', 255, ndvi], ['*', 255, ndwi], ['band', 4], ], }, source, }), ], view: source.getView(), });
|