diff --git a/config/default/common/config/wv.json/layers/viirs/noaa20/VIIRS_NOAA20_CorrectedReflectance_BandsM11-I2-I1_Granule.json b/config/default/common/config/wv.json/layers/viirs/noaa20/VIIRS_NOAA20_CorrectedReflectance_BandsM11-I2-I1_Granule.json index f5f0461ab1..dd53ea495d 100644 --- a/config/default/common/config/wv.json/layers/viirs/noaa20/VIIRS_NOAA20_CorrectedReflectance_BandsM11-I2-I1_Granule.json +++ b/config/default/common/config/wv.json/layers/viirs/noaa20/VIIRS_NOAA20_CorrectedReflectance_BandsM11-I2-I1_Granule.json @@ -11,8 +11,7 @@ "associatedLayers": ["VIIRS_NOAA20_CorrectedReflectance_BandsM11-I2-I1"], "availability": { "rollingWindow": 30 - }, - "disableSnapshot": true + } } } } \ No newline at end of file diff --git a/config/default/common/config/wv.json/layers/viirs/noaa20/VIIRS_NOAA20_CorrectedReflectance_BandsM3-I3-M11_Granule.json b/config/default/common/config/wv.json/layers/viirs/noaa20/VIIRS_NOAA20_CorrectedReflectance_BandsM3-I3-M11_Granule.json index d98d7379bf..4f076804b0 100644 --- a/config/default/common/config/wv.json/layers/viirs/noaa20/VIIRS_NOAA20_CorrectedReflectance_BandsM3-I3-M11_Granule.json +++ b/config/default/common/config/wv.json/layers/viirs/noaa20/VIIRS_NOAA20_CorrectedReflectance_BandsM3-I3-M11_Granule.json @@ -11,8 +11,7 @@ "associatedLayers": ["VIIRS_NOAA20_CorrectedReflectance_BandsM3-I3-M11"], "availability": { "rollingWindow": 30 - }, - "disableSnapshot": true + } } } } \ No newline at end of file diff --git a/config/default/common/config/wv.json/layers/viirs/noaa20/VIIRS_NOAA20_CorrectedReflectance_TrueColor_Granule.json b/config/default/common/config/wv.json/layers/viirs/noaa20/VIIRS_NOAA20_CorrectedReflectance_TrueColor_Granule.json index 0d04305605..eb89861a26 100644 --- a/config/default/common/config/wv.json/layers/viirs/noaa20/VIIRS_NOAA20_CorrectedReflectance_TrueColor_Granule.json +++ b/config/default/common/config/wv.json/layers/viirs/noaa20/VIIRS_NOAA20_CorrectedReflectance_TrueColor_Granule.json @@ -11,8 +11,7 @@ "associatedLayers": ["VIIRS_NOAA20_CorrectedReflectance_TrueColor"], "availability": { "rollingWindow": 30 - }, - "disableSnapshot": true + } } } } \ No newline at end of file diff --git a/config/default/common/config/wv.json/layers/viirs/snpp/VIIRS_SNPP_CorrectedReflectance_BandsM11-I2-I1_Granule.json b/config/default/common/config/wv.json/layers/viirs/snpp/VIIRS_SNPP_CorrectedReflectance_BandsM11-I2-I1_Granule.json index 685ae52027..83801b0242 100644 --- a/config/default/common/config/wv.json/layers/viirs/snpp/VIIRS_SNPP_CorrectedReflectance_BandsM11-I2-I1_Granule.json +++ b/config/default/common/config/wv.json/layers/viirs/snpp/VIIRS_SNPP_CorrectedReflectance_BandsM11-I2-I1_Granule.json @@ -11,8 +11,7 @@ "associatedLayers": ["VIIRS_SNPP_CorrectedReflectance_BandsM11-I2-I1"], "availability": { "rollingWindow": 30 - }, - "disableSnapshot": true + } } } } \ No newline at end of file diff --git a/config/default/common/config/wv.json/layers/viirs/snpp/VIIRS_SNPP_CorrectedReflectance_BandsM3-I3-M11_Granule.json b/config/default/common/config/wv.json/layers/viirs/snpp/VIIRS_SNPP_CorrectedReflectance_BandsM3-I3-M11_Granule.json index 7d6a48c340..f00d5c21fd 100644 --- a/config/default/common/config/wv.json/layers/viirs/snpp/VIIRS_SNPP_CorrectedReflectance_BandsM3-I3-M11_Granule.json +++ b/config/default/common/config/wv.json/layers/viirs/snpp/VIIRS_SNPP_CorrectedReflectance_BandsM3-I3-M11_Granule.json @@ -11,8 +11,7 @@ "associatedLayers": ["VIIRS_SNPP_CorrectedReflectance_BandsM3-I3-M11"], "availability": { "rollingWindow": 30 - }, - "disableSnapshot": true + } } } } \ No newline at end of file diff --git a/config/default/common/config/wv.json/layers/viirs/snpp/VIIRS_SNPP_CorrectedReflectance_TrueColor_Granule.json b/config/default/common/config/wv.json/layers/viirs/snpp/VIIRS_SNPP_CorrectedReflectance_TrueColor_Granule.json index 0d39b9e749..8fdba9b9dc 100644 --- a/config/default/common/config/wv.json/layers/viirs/snpp/VIIRS_SNPP_CorrectedReflectance_TrueColor_Granule.json +++ b/config/default/common/config/wv.json/layers/viirs/snpp/VIIRS_SNPP_CorrectedReflectance_TrueColor_Granule.json @@ -11,8 +11,7 @@ "associatedLayers": ["VIIRS_SNPP_CorrectedReflectance_TrueColor"], "availability": { "rollingWindow": 30 - }, - "disableSnapshot": true + } } } } \ No newline at end of file diff --git a/web/js/components/image-download/image-download-panel.js b/web/js/components/image-download/image-download-panel.js index 5f1dca1195..a96d63307c 100644 --- a/web/js/components/image-download/image-download-panel.js +++ b/web/js/components/image-download/image-download-panel.js @@ -59,10 +59,12 @@ function ImageDownloadPanel(props) { const time = new Date(date.getTime()); const layerList = getLayers(); + const granuleDatesMap = new Map(map.getLayers().getArray().map((layer) => [layer.wv.id, layer.wv.granuleDates])); + const layerDefs = layerList.map((def) => ({ ...def, granuleDates: granuleDatesMap.get(def.id) })); const dlURL = getDownloadUrl( url, projection, - layerList, + layerDefs, lonlats, { width, height }, time, diff --git a/web/js/modules/image-download/util.js b/web/js/modules/image-download/util.js index dcedea1e28..6c2d53e602 100644 --- a/web/js/modules/image-download/util.js +++ b/web/js/modules/image-download/util.js @@ -10,6 +10,7 @@ import { CRS } from '../map/constants'; const GEO_ESTIMATION_CONSTANT = 256.0; const POLAR_ESTIMATION_CONSTANT = 0.002197265625; +const GRANULE_LIMIT = 15; /** * Get a date time snapped to the interval of the layer with the shortest interval. @@ -281,6 +282,18 @@ export function getDownloadUrl(url, proj, layerDefs, bbox, dimensions, dateTime, const imgFormat = fileType || 'image/jpeg'; const { height, width } = dimensions; const snappedDateTime = getLatestIntervalTime(layerDefs, dateTime); + let numGranules = 0; + const granuleDates = layerDefs.reduce((acc, def, i) => { + let granuleDatesString = acc; + if (!def.granuleDates) return granuleDatesString; + granuleDatesString = `${acc}${i};`; // ensure that each granule layer gets an index + if (numGranules >= GRANULE_LIMIT) return granuleDatesString; // limit number of granules + const numToAdd = GRANULE_LIMIT - numGranules; + const truncatedDates = def.granuleDates.slice(0, numToAdd); + numGranules += truncatedDates.length; + const processedDates = truncatedDates.map((date) => date.split(':').filter((d) => d !== '00Z').join(':')); + return `${granuleDatesString}${processedDates.join(',')},`; + }, ''); const params = [ 'REQUEST=GetSnapshot', `TIME=${util.toISOStringSeconds(snappedDateTime)}`, @@ -292,6 +305,9 @@ export function getDownloadUrl(url, proj, layerDefs, bbox, dimensions, dateTime, `WIDTH=${width}`, `HEIGHT=${height}`, ]; + if (granuleDates.length > 0) { + params.push(`granule_dates=${granuleDates}`); + } if (opacities.length > 0) { params.push(`OPACITIES=${opacities.join(',')}`); }