Interactive interface for browsing global, full-resolution satellite imagery
init add dateline cross detection and warning icon
Ed Plato06c6fea8bd50
diff --git a/web/css/image.css b/web/css/image.cssindex e279ecc7d..e790d0516 100644--- a/web/css/image.css+++ b/web/css/image.css@@ -93,3 +93,23 @@.wv-image-top {text-align: right;}++.snapshots-date-header {+ display: flex;+ & .date-text {+ font: 400 12px 'Arial';+ }+}++.snapshot-date-alert-icon {+ font-size: 10px;+ position: absolute;+ bottom: 8px;+ right: 5px;+ color: #f60;+ cursor: pointer;+}++.snapshot-date-warning-tooltip-inner {+ line-height: 16px;+}diff --git a/web/js/components/image-download/panel.js b/web/js/components/image-download/panel.jsindex 3c3aa691b..7e40a49ee 100644--- a/web/js/components/image-download/panel.js+++ b/web/js/components/image-download/panel.js@@ -1,14 +1,16 @@import React from 'react';import PropTypes from 'prop-types';import googleTagManager from 'googleTagManager';+import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';import {imageSizeValid,getDimensions,getDownloadUrl,} from '../../modules/image-download/util';-+import util from '../../util/util';import SelectionList from '../util/selector';import ResTable from './grid';+import HoverTooltip from '../util/hover-tooltip';const MAX_DIMENSION_SIZE = 8200;const RESOLUTION_KEY = {@@ -146,9 +148,33 @@ export default class ImageResSelection extends React.Component {}}+ getDatelineMessage() {+ const { datelineMessage } = this.props;+ return datelineMessage && (+ <div+ className="snapshot-date-alert-icon"+ >+ <FontAwesomeIcon+ icon="exclamation-triangle"+ id="snapshot-date-warning-tooltip"+ size="2x"+ />+ <HoverTooltip+ isMobile={false}+ labelText={datelineMessage}+ target="snapshot-date-warning-tooltip"+ delay={{ show: 0, hide: 200 }}+ fade={false}+ placement="left-start"+ innerClassName="snapshot-date-warning-tooltip-inner"+ />+ </div>+ );+ }+render() {const {- getLayers, projection, lonlats, resolutions, maxImageSize, firstLabel,+ date, getLayers, hasSubdailyLayers, projection, lonlats, resolutions, maxImageSize, firstLabel,} = this.props;const { resolution, debugUrl } = this.state;const dimensions = getDimensions(projection.id, lonlats, resolution);@@ -157,6 +183,8 @@ export default class ImageResSelection extends React.Component {const filetypeSelect = this._renderFileTypeSelect();const worldfileSelect = this._renderWorldfileSelect();const layerList = getLayers();+ const displayDate = util.toISOStringDateMonthAbbrev(date, hasSubdailyLayers);+return (<div className="wv-re-pick-wrapper wv-image"><div@@ -164,6 +192,12 @@ export default class ImageResSelection extends React.Component {style={{ display: 'none' }}url={debugUrl}/>+ <div className="wv-image-header snapshots-date-header">+ <div className="date-text">+ Date: + {displayDate}+ </div>+ </div><div className="wv-image-header"><SelectionListid="wv-image-resolution"@@ -185,6 +219,7 @@ export default class ImageResSelection extends React.Component {validLayers={layerList.length > 0}onClick={this.onDownload}/>+ {this.getDatelineMessage()}</div>);}@@ -202,11 +237,13 @@ ImageResSelection.defaultProps = {};ImageResSelection.propTypes = {date: PropTypes.object,+ datelineMessage: PropTypes.string,fileType: PropTypes.string,fileTypeOptions: PropTypes.bool,fileTypes: PropTypes.object,firstLabel: PropTypes.string,getLayers: PropTypes.func,+ hasSubdailyLayers: PropTypes.bool,isWorldfile: PropTypes.bool,lonlats: PropTypes.array,maxImageSize: PropTypes.string,diff --git a/web/js/components/timeline/date-util.js b/web/js/components/timeline/date-util.jsindex ae4b65d4c..6202249ea 100644--- a/web/js/components/timeline/date-util.js+++ b/web/js/components/timeline/date-util.js@@ -22,11 +22,7 @@ export const getISODateFormatted = (date) => `${new Date(date).toISOString().spl// display date as '2000 OCT 28' for default or '2000 OCT 28 20:28Z' for subdailyexport const getDisplayDate = (date, isSubdaily) => {- let displayDate = util.toISOStringDateMonthAbbrev(new Date(date));- if (isSubdaily) {- const subdailyHHSSZ = `${getISODateFormatted(date).split('T')[1].split(':', 2).join(':')}Z`;- displayDate += ` ${subdailyHHSSZ}`;- }+ const displayDate = util.toISOStringDateMonthAbbrev(new Date(date), isSubdaily);return displayDate;};diff --git a/web/js/components/util/hover-tooltip.js b/web/js/components/util/hover-tooltip.jsindex a4d52cb63..aa2dfa9a5 100644--- a/web/js/components/util/hover-tooltip.js+++ b/web/js/components/util/hover-tooltip.js@@ -11,7 +11,7 @@ import {*/const HoverTooltip = (props) => {const {- isMobile, labelText, placement, target,+ delay, fade, innerClassName, isMobile, labelText, placement, target,} = props;return !isMobile && (@@ -20,6 +20,9 @@ const HoverTooltip = (props) => {target={target}boundariesElement="window"placement={placement}+ delay={delay}+ fade={fade}+ innerClassName={innerClassName}>{labelText}</UncontrolledTooltip>@@ -28,9 +31,15 @@ const HoverTooltip = (props) => {HoverTooltip.defaultProps = {placement: 'bottom',+ delay: { show: 50, hide: 300 },+ fade: true,+ innerClassName: '',};HoverTooltip.propTypes = {+ delay: PropTypes.object,+ fade: PropTypes.bool,+ innerClassName: PropTypes.string,isMobile: PropTypes.bool,labelText: PropTypes.string,placement: PropTypes.string,diff --git a/web/js/containers/image-download.js b/web/js/containers/image-download.jsindex 396cfa574..5a3084017 100644--- a/web/js/containers/image-download.js+++ b/web/js/containers/image-download.js@@ -92,7 +92,7 @@ class ImageDownloadContainer extends Component {boundaries,map.ui.selected,);- const { crs } = proj.selected;+ const { crs, maxExtent } = proj.selected;const geolonlat1 = olProj.transform(lonlats[0], crs, 'EPSG:4326');const geolonlat2 = olProj.transform(lonlats[1], crs, 'EPSG:4326');@@ -104,6 +104,22 @@ class ImageDownloadContainer extends Component {);const boxTopLongitude = Math.abs(geolonlat1[0]) > 180 ? util.normalizeWrappedLongitude(geolonlat1[0]) : geolonlat1[0];const boxBottomLongitude = Math.abs(geolonlat2[0]) > 180 ? util.normalizeWrappedLongitude(geolonlat2[0]) : geolonlat2[0];++ let datelineMessage = '';+ if (isGeoProjection) {+ // min longitude less than maxExtent min longitude (-180 geographic)+ if (geolonlat1[0] < maxExtent[0]) {+ const nextDay = util.toISOStringDateMonthAbbrev(util.dateAdd(util.clearTimeUTC(date), 'day', 1));+ datelineMessage = `Part of the selected snapshot crossed the dateline and uses imagery from the next day ${nextDay}.`;+ }++ // max longitude greater than maxExtent max longitude (180 geographic)+ if (geolonlat2[0] > maxExtent[2]) {+ const prevDay = util.toISOStringDateMonthAbbrev(util.dateAdd(util.clearTimeUTC(date), 'day', -1));+ datelineMessage = `Part of the selected snapshot crossed the dateline and uses imagery from the previous day ${prevDay}.`;+ }+ }+return (<ErrorBoundary><Panel@@ -117,6 +133,7 @@ class ImageDownloadContainer extends Component {hasSubdailyLayers={hasSubdailyLayers}markerCoordinates={markerCoordinates}date={date}+ datelineMessage={datelineMessage}url={url}crs={crs}getLayers={getLayers}@@ -216,9 +233,6 @@ export default connect(mapDispatchToProps,)(ImageDownloadContainer);-ImageDownloadContainer.defualtProps = {- fileType: 'image/jpeg',-};ImageDownloadContainer.propTypes = {closeModal: PropTypes.func.isRequired,fileType: PropTypes.string.isRequired,diff --git a/web/js/util/util.js b/web/js/util/util.jsindex dc4ba3796..de1c17c7f 100644--- a/web/js/util/util.js+++ b/web/js/util/util.js@@ -304,9 +304,10 @@ export default (function(self) {* @method toISOStringDateMonthAbbrev* @static* @param date {Date} the date to convert- * @return {string} ISO string in the form of ``YYYY-MMM-DD``.+ * @param hasSubdaily {Boolean} has subdaily date+ * @return {string} ISO string in the form of `YYYY MMM DD` -or- `YYYY MMM DD HH:SSZ` for subdaily.*/- self.toISOStringDateMonthAbbrev = function(date) {+ self.toISOStringDateMonthAbbrev = function(date, hasSubdaily) {const stringDate = self.toISOStringDate(date).split('-');const year = stringDate[0];const month = stringDate[1];@@ -314,6 +315,9 @@ export default (function(self) {const monthAbbrev = self.monthStringArray[Number(month) - 1];+ if (hasSubdaily) {+ return `${year} ${monthAbbrev} ${day} ${self.toHourMinutes(date)}Z`;+ }return `${year} ${monthAbbrev} ${day}`;};