Remove multi-source restrictions and fix alpha

This commit is contained in:
Andreas Hocevar
2021-08-06 22:05:15 +02:00
parent 7f3f4e6cdd
commit e8ead306ff
3 changed files with 36 additions and 45 deletions

View File

@@ -6,7 +6,8 @@ docs: >
The GeoTIFF layer in this example calculates the Normalized Difference Vegetation Index (NDVI)
and Normalized Difference Water Index (NDWI) from two cloud-optimized Sentinel 2 GeoTIFFs: one
with 10 m resolution and red and a near infrared bands, and one with 60 m resolution and a short
wave infrared channel. The NDVI is shown as green, the NDWI as blue.
wave infrared channel. The NDVI is shown as green, the NDWI as blue. The 4th band is the alpha
band, which gets added when a source has a `nodata` value configured.
tags: "cog, ndvi, ndwi, sentinel, geotiff"
---
<div id="map" class="map"></div>

View File

@@ -7,17 +7,16 @@ const source = new GeoTIFF({
sources: [
{
url: 'https://s2downloads.eox.at/demo/Sentinel-2/3857/R10m.tif',
samples: [2],
max: 65535,
},
{
url: 'https://s2downloads.eox.at/demo/Sentinel-2/3857/R10m.tif',
samples: [3],
bands: [2, 3],
min: 0,
nodata: 0,
max: 65535,
},
{
url: 'https://s2downloads.eox.at/demo/Sentinel-2/3857/R60m.tif',
samples: [8],
bands: [8],
min: 0,
nodata: 0,
max: 65535,
},
],
@@ -51,6 +50,8 @@ const map = new Map({
['*', 255, ndvi],
// blue: NDWI
['*', 255, ndwi],
// alpha
['band', 4],
],
},
source,