Interactive interface for browsing global, full-resolution satellite imagery
revise GIF url creation to new WVS format, add maxImageDimensionSize valid check, minor revisions in GIF panel
Edward Platoafd88014dcc7
diff --git a/web/js/animation/gif.js b/web/js/animation/gif.jsindex 3f01fee9e..d5480a7e3 100644--- a/web/js/animation/gif.js+++ b/web/js/animation/gif.js@@ -16,7 +16,8 @@ import {imageUtilCalculateResolution,imageUtilGetLayers,imageUtilGetCoordsFromPixelValues,- imageUtilGetConversionFactor+ imageUtilGetConversionFactor,+ bboxWMS13} from '../image/util';import util from '../util/util';import wvui from '../ui/ui';@@ -24,6 +25,7 @@ import uiIndicator from '../ui/indicator';const gifStream = new GifStream();const conversionConstant = 3.6; // we are saying that the gif compresses each total by about 3.6x+const maxImageDimensionSize = 8200;const maxGifSize = 250;const GRATICULE_WARNING ='The graticule layer cannot be used to take a snapshot. Would you ' +@@ -117,6 +119,7 @@ export function animationGif(models, config, ui) {endDate: null,speed: null,maxGifSize: maxGifSize,+ maxImageDimensionSize: maxImageDimensionSize,checked: true,increment: lodashCapitalize(ui.anim.widget.getIncrements())};@@ -202,7 +205,9 @@ export function animationGif(models, config, ui) {};var fileSizeValid = function() {- return requestSize < maxGifSize && imgHeight !== 0 && imgWidth !== 0;+ return requestSize < maxGifSize &&+ imgHeight !== 0 && imgWidth !== 0 &&+ imgHeight <= maxImageDimensionSize && imgWidth <= maxImageDimensionSize;};var setDownloadButtonClass = function() {@@ -513,33 +518,29 @@ export function animationGif(models, config, ui) {**/var getImageArray = function(startDate, endDate, interval) {- var url;var a = [];var fromDate = new Date(startDate);var toDate = new Date(endDate);var current = fromDate;- var host;- var path;var j = 0;var src;var strDate;- var lonlat = imageUtilGetCoordsFromPixelValues(+ var lonlats = imageUtilGetCoordsFromPixelValues(animationCoordinates,ui.map.selected);var layers;var proj = models.proj.selected.id;var opacities;- var epsg = models.proj.selected.epsg;+ let crs = models.proj.selected.crs;+ let imgFormat = 'image/jpeg';var products = getProducts();var intervalAmount = 1;- if (config.features.imageDownload) {- host = config.features.imageDownload.host;- path = config.parameters.imagegen || config.features.imageDownload.path;- } else {- host = 'https://gibs.earthdata.nasa.gov';- path = 'image-download';+ let url = 'http://localhost:3002/api/v1/snapshot';+ if (config.features.imageDownload && config.features.imageDownload.url) {+ url = config.features.imageDownload.url;+ util.warn('Redirecting GIF download to: ' + url);}while (current <= toDate) {@@ -553,26 +554,24 @@ export function animationGif(models, config, ui) {layers = imageUtilGetLayers(products, proj);opacities = imageUtilGetLayerOpacities(products);- url = util.format(- host +- '/' +- path +- '?{1}&extent={2}&epsg={3}&layers={4}&opacities={5}&worldfile=false&format=image/jpeg&width={6}&height={7}',- 'TIME={1}',- lonlat[0][0] +- ',' +- lonlat[0][1] +- ',' +- lonlat[1][0] +- ',' +- lonlat[1][1],- epsg,- layers.join(','),- opacities.join(','),- imgWidth,- imgHeight- );- src = util.format(url, strDate);++ let params = [+ 'REQUEST=GetSnapshot',+ `TIME=${util.toISOStringDate(current)}`,+ `BBOX=${bboxWMS13(lonlats, crs)}`,+ `CRS=${crs}`,+ `LAYERS=${layers.join(',')}`,+ `FORMAT=${imgFormat}`,+ `WIDTH=${imgWidth}`,+ `HEIGHT=${imgHeight}`+ ];+ if (opacities.length > 0) {+ params.push(`OPACITIES=${opacities.join(',')}`);+ }++ let dlURL = url + '?' + params.join('&') + `&ts=${Date.now()}`;++ src = util.format(dlURL, strDate);a.push({src: src,text: showDates ? strDate : '',diff --git a/web/js/components/animation-widget/gif-panel-grid.js b/web/js/components/animation-widget/gif-panel-grid.jsindex 447331527..cedde4b75 100644--- a/web/js/components/animation-widget/gif-panel-grid.js+++ b/web/js/components/animation-widget/gif-panel-grid.js@@ -14,13 +14,13 @@ export class GifPanelGrid extends React.Component {return (<div id='gif-size' className='gif-size gif-size-invalid grid-child'><i className='fa fa-times fa-fw' />- <span>{'~' + size + ' MB (Before Compression)'}</span>+ <span>{this.props.maxGifSize + ' MB' + '~' + size + ' MB'}</span></div>);} else {return (<div id='gif-size' className='gif-size grid-child'>- <span>{'~' + size + ' MB (Before Compression)'} </span>+ <span>{this.props.maxGifSize + ' MB / ~' + size + ' MB'} </span></div>);}@@ -37,15 +37,15 @@ export class GifPanelGrid extends React.Component {<div className='grid-child'><span>{this.props.speed + ' Frames Per Second'}</span></div><div className='grid-child label'><span>Increment:</span></div><div className='grid-child'><span>{this.props.increment}</span></div>- <div className='grid-child label'><span>Request Size:</span></div>+ <div className='grid-child label'><span>Max / Raw Size:</span></div>{imageSize}- <div className='grid-child label'><span>Max Request Size: </span></div>+ <div className='grid-child label'><span>Max Dimension: </span></div><div className={this.props.valid ? 'grid-child gif-max-size' : 'grid-child gif-max-size gif-size-invalid'}>- <span>{this.props.maxGifSize + ' MB (Before Compression)'}</span>+ <span>{this.props.maxImageDimensionSize + 'px'}</span></div><div className='grid-child label'><span>Image Dimensions:</span></div><div className='grid-child' id='wv-image-width'>- <span>{this.props.width + ' x ' + this.props.height + 'px' }</span>+ <span>{this.props.width + 'px x ' + this.props.height + 'px' }</span></div></div>);@@ -55,6 +55,7 @@ GifPanelGrid.propTypes = {width: PropTypes.number,height: PropTypes.number,maxGifSize: PropTypes.number,+ maxImageDimensionSize: PropTypes.number,startDate: PropTypes.string,endDate: PropTypes.string,speed: PropTypes.number,diff --git a/web/js/components/animation-widget/gif-panel.js b/web/js/components/animation-widget/gif-panel.jsindex a88aa779b..ef42f2f2b 100644--- a/web/js/components/animation-widget/gif-panel.js+++ b/web/js/components/animation-widget/gif-panel.js@@ -51,6 +51,7 @@ export default class GifPanel extends React.Component {height={this.state.imgHeight}requestSize={this.state.requestSize}maxGifSize={this.props.maxGifSize}+ maxImageDimensionSize={this.props.maxImageDimensionSize}valid={this.state.valid}onClick={this.props.onDownloadClick}startDate={this.state.startDate}@@ -88,6 +89,7 @@ GifPanel.propTypes = {imgWidth: PropTypes.number,imgHeight: PropTypes.number,maxGifSize: PropTypes.number,+ maxImageDimensionSize: PropTypes.number,showDates: PropTypes.bool,onDownloadClick: PropTypes.func,onClick: PropTypes.func,