Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Fix bugs with orbit tracks interactions

Ben870982d0d47c
diff --git a/config/default/common/vectorstyles/OrbitTracks_Aqua_Ascending.json b/config/default/common/vectorstyles/OrbitTracks_Aqua_Ascending.json
index 1534e4b3f..cf2c73b94 100644
--- a/config/default/common/vectorstyles/OrbitTracks_Aqua_Ascending.json
+++ b/config/default/common/vectorstyles/OrbitTracks_Aqua_Ascending.json
@@ -30,31 +30,24 @@
[
"zoom"
],
- 5,
- 1,
- 7,
- 3,
- 11,
- 5,
- 14
- ],
- "text-transform": "uppercase",
- "text-letter-spacing": 0.05,
- "text-radial-offset": 1,
- "text-variable-anchor": [
- "right",
- "left"
- ]
- },
- "paint": {
- "text-color": "#fff",
- "text-halo-color": "#999",
- "text-halo-width": 1,
- "text-opacity": [
- "step",
[
- "zoom"
+ "case",
+ [
+ "!=",
+ [
+ "%",
+ [
+ "get",
+ "minute"
+ ],
+ 10
+ ],
+ 0
+ ],
+ 0,
+ 7
],
+ 1,
[
"case",
[
@@ -70,7 +63,7 @@
0
],
0,
- 1
+ 7
],
3,
[
@@ -88,11 +81,23 @@
0
],
0,
- 1
+ 11
],
5,
- 1
+ 14
+ ],
+ "text-transform": "uppercase",
+ "text-letter-spacing": 0.05,
+ "text-radial-offset": 1,
+ "text-variable-anchor": [
+ "right",
+ "left"
]
+ },
+ "paint": {
+ "text-color": "#fff",
+ "text-halo-color": "#999",
+ "text-halo-width": 1
}
},
{
@@ -118,20 +123,24 @@
[
"zoom"
],
- 1.5,
- 1,
- 2.5,
- 3,
- 3.5,
- 5,
- 5
- ],
- "circle-color": "rgb(21, 192, 230)",
- "circle-opacity": [
- "step",
[
- "zoom"
+ "case",
+ [
+ "!=",
+ [
+ "%",
+ [
+ "get",
+ "minute"
+ ],
+ 10
+ ],
+ 0
+ ],
+ 0,
+ 1.5
],
+ 1,
[
"case",
[
@@ -147,7 +156,7 @@
0
],
0,
- 1
+ 2.5
],
3,
[
@@ -165,11 +174,13 @@
0
],
0,
- 1
+ 3.5
],
5,
- 1
- ]
+ 5
+ ],
+ "circle-color": "rgb(21, 192, 230)",
+ "circle-opacity": 1
}
}
]
diff --git a/web/js/components/vector-metadata/table.js b/web/js/components/vector-metadata/table.js
index 021097d13..54e692fc0 100644
--- a/web/js/components/vector-metadata/table.js
+++ b/web/js/components/vector-metadata/table.js
@@ -36,8 +36,8 @@ export default class VectorMetaTable extends React.Component {
const isIntegerToStyle = properties.Function !== 'Identify' && (properties.DataType === 'int');
const value = properties.ValueMap
? properties.ValueMap[metaFeatures[featureId]]
- : isIntegerToStyle ? metaFeatures[featureId].toLocaleString('en')
- : metaFeatures[featureId];
+ : isIntegerToStyle && metaFeatures[featureId] ? metaFeatures[featureId].toLocaleString('en')
+ : metaFeatures[featureId] ? metaFeatures[featureId] : null;
const id = util.cleanId(String(`${title}-${metaIndex + index}`));
if (!value) return undefined;
return (
diff --git a/web/js/containers/map-interactions/ol-vector-interactions.js b/web/js/containers/map-interactions/ol-vector-interactions.js
index 478e016ac..f923d8aff 100644
--- a/web/js/containers/map-interactions/ol-vector-interactions.js
+++ b/web/js/containers/map-interactions/ol-vector-interactions.js
@@ -7,6 +7,7 @@ import {
} from 'lodash';
import React from 'react';
import PropTypes from 'prop-types';
+import * as olExtent from 'ol/extent';
import { transform } from 'ol/proj';
import { isFromActiveCompareRegion } from '../../modules/compare/util';
import { hasNonClickableVectorLayer } from '../../modules/layers/util';
@@ -54,7 +55,8 @@ export class VectorInteractions extends React.Component {
let isActiveLayer = false;
map.forEachFeatureAtPixel(pixels, (feature, layer) => {
const def = lodashGet(layer, 'wv.def');
- if (!def || lodashIncludes(def.clickDisabledFeatures, feature.getType())) return;
+ const featureOutsideExtent = !olExtent.containsCoordinate(layer.get('extent'), map.getCoordinateFromPixel(pixels));
+ if (!def || lodashIncludes(def.clickDisabledFeatures, feature.getType()) || featureOutsideExtent) return;
const isWrapped = proj.id === 'geographic' && (def.wrapadjacentdays || def.wrapX);
const isRenderedFeature = isWrapped ? lon > -250 || lon < 250 || lat > -90 || lat < 90 : true;
if (isRenderedFeature && isFromActiveCompareRegion(pixels, layer.wv, compareState, swipeOffset)) {
diff --git a/web/js/map/runningdata.js b/web/js/map/runningdata.js
index 3244b4cf5..da8f7e8d9 100644
--- a/web/js/map/runningdata.js
+++ b/web/js/map/runningdata.js
@@ -3,6 +3,7 @@ import {
isEmpty as lodashIsEmpty,
isEqual as lodashIsEqual,
} from 'lodash';
+import * as olExtent from 'ol/extent';
import util from '../util/util';
import { getPalette } from '../modules/palettes/selectors';
import {
@@ -51,7 +52,9 @@ export default function MapRunningData(models, compareUi, store) {
if (!def) return;
const isWrapped = proj.id === 'geographic' && (def.wrapadjacentdays || def.wrapX);
const isRenderedFeature = isWrapped ? lon > -250 || lon < 250 || lat > -90 || lat < 90 : true;
- if (!isRenderedFeature || !isFromActiveCompareRegion(pixels, layer.wv, state.compare, swipeOffset)) return;
+ const featureOutsideExtent = !olExtent.containsCoordinate(layer.get('extent'), map.getCoordinateFromPixel(pixels));
+
+ if (!isRenderedFeature || !isFromActiveCompareRegion(pixels, layer.wv, state.compare, swipeOffset) || featureOutsideExtent) return;
const hasPalette = !lodashIsEmpty(def.palette);
if (!hasPalette) return;
diff --git a/web/js/modules/vector-styles/selectors.js b/web/js/modules/vector-styles/selectors.js
index 31129c5a8..eef87f9ad 100644
--- a/web/js/modules/vector-styles/selectors.js
+++ b/web/js/modules/vector-styles/selectors.js
@@ -132,22 +132,21 @@ export function setStyleFunction(def, vectorStyleId, vectorStyles, layer, state)
// Filter Orbit Tracks
if (glStyle.name === 'Orbit Tracks'
&& (selected[layerId] && selected[layerId].length)) {
- const selectedFeatures = selected[layerId];
- layerInLayerGroup.setStyle((feature, resolution) => {
- const data = state.config.vectorData[def.vectorData.id];
- const properties = data.mvt_properties;
- const features = feature.getProperties();
- const idKey = lodashFind(properties, { Function: 'Identify' }).Identifier;
- const minutes = feature.get('label');
- const uniqueIdentifier = features[idKey];
- if (shouldRenderFeature(feature, acceptableExtent)) {
- if (minutes && uniqueIdentifier && selectedFeatures && selectedFeatures.includes(uniqueIdentifier)) {
- return selectedStyleFunction(feature, styleFunction(feature, resolution), 1.5);
- }
- return styleFunction(feature, resolution);
- }
- return styleFunction(feature, resolution);
- });
+ // const selectedFeatures = selected[layerId];
+ // layerInLayerGroup.setStyle((feature, resolution) => {
+ // const data = state.config.vectorData[def.vectorData.id];
+ // const properties = data.mvt_properties;
+ // const features = feature.getProperties();
+ // const idKey = lodashFind(properties, { Function: 'Identify' }).Identifier;
+ // const uniqueIdentifier = features[idKey];
+ // if (feature.getType() === 'point' && shouldRenderFeature(feature, acceptableExtent)) {
+ // if (uniqueIdentifier && selectedFeatures && selectedFeatures.includes(uniqueIdentifier)) {
+ // return selectedStyleFunction(feature, styleFunction(feature, resolution));
+ // }
+ // return styleFunction(feature, resolution);
+ // }
+ // return styleFunction(feature, resolution);
+ // });
} else if ((glStyle.name !== 'Orbit Tracks')
&& (selected[layerId] && selected[layerId].length)) {
const selectedFeatures = selected[layerId];