Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

update tiff format, only use opacities when a layer is transparent

Mike McGann8690c9fec0f3
diff --git a/web/js/image/panel.js b/web/js/image/panel.js
index 174c8518b..b645b28f3 100644
--- a/web/js/image/panel.js
+++ b/web/js/image/panel.js
@@ -42,7 +42,7 @@ const fileTypesGeo = {
values: [
{ value: 'image/jpeg', text: 'JPEG' },
{ value: 'image/png', text: 'PNG' },
- { value: 'image/geotiff', text: 'GeoTIFF' },
+ { value: 'image/tiff', text: 'GeoTIFF' },
{ value: 'application/vnd.google-earth.kmz', text: 'KMZ' }
]
};
@@ -50,7 +50,7 @@ const fileTypesPolar = {
values: [
{ value: 'image/jpeg', text: 'JPEG' },
{ value: 'image/png', text: 'PNG' },
- { value: 'image/geotiff', text: 'GeoTIFF' }
+ { value: 'image/tiff', text: 'GeoTIFF' }
]
};
@@ -343,14 +343,15 @@ export function imagePanel(models, ui, config, dialogConfig) {
`LAYERS=${layers.join(',')}`,
`FORMAT=${imgFormat}`,
`WIDTH=${imgWidth}`,
- `HEIGHT=${imgHeight}`,
- `OPACITIES=${opacities.join(',')}`,
- `ts=${Date.now()}`
+ `HEIGHT=${imgHeight}`
];
+ if (opacities.length > 0) {
+ params.push(`OPACITIES=${opacities.join(',')}`);
+ }
if (imgWorldfile === 'true') {
params.push('WORLDFILE=true');
}
- let dlURL = url + '?' + params.join('&');
+ let dlURL = url + '?' + params.join('&') + `&ts=${Date.now()}`;
googleTagManager.pushEvent({
event: 'image_download',
diff --git a/web/js/image/util.js b/web/js/image/util.js
index e3fdfeff0..badef18fd 100644
--- a/web/js/image/util.js
+++ b/web/js/image/util.js
@@ -92,18 +92,22 @@ export function imageUtilGetLayers (products, proj) {
* @returns {array} array of opacities
*
*/
-export function imageUtilGetLayerOpacities (products) {
- var opacities = [];
- lodashEach(products, function(product) {
+export function imageUtilGetLayerOpacities (layers) {
+ let opacities = [];
+ let found = false;
+ layers.forEach((layer) => {
let opacity = '';
- if ('opacity' in product) {
- opacity = product.opacity;
- }
- if (opacity === 1) {
+ if ('opacity' in layer && layer.opacity !== 1) {
+ opacity = layer.opacity;
+ found = true;
+ } else {
opacity = '';
}
opacities.push(opacity);
});
+ if (!found) {
+ return [];
+ }
return opacities;
};