Interactive interface for browsing global, full-resolution satellite imagery
WV-3045 WVS granule layer snapshots (#5162)
Patrick Moulden121f4dcaece6
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.jsonindex f5f0461ab..dd53ea495 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 filediff --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.jsonindex d98d7379b..4f076804b 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 filediff --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.jsonindex 0d0430560..eb89861a2 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 filediff --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.jsonindex 685ae5202..83801b024 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 filediff --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.jsonindex 7d6a48c34..f00d5c21f 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 filediff --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.jsonindex 0d39b9e74..8fdba9b9d 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 filediff --git a/web/js/components/image-download/image-download-panel.js b/web/js/components/image-download/image-download-panel.jsindex 5f1dca119..a96d63307 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.jsindex dcedea1e2..6c2d53e60 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(',')}`);}