Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Better filtering for Orbit Tracks. Added capitalize utility. - Added a check in self.addDescriptions to specifically look for the Orbital Track measurement file and only map the description set in this file to orbit layers. Previously, orbit layers would get their description from the last measurement it was associated with which produced the wrong descriptions. - Added a check in self.addDescriptions for if a description has been manually set in the file; if not it will fallback to use the measurement description. This will allow us to slowly migrate to per-layer descriptions. - Added a check for the new `layergroup` flag in the layers modal and set the layer time / track title based on the new `time` and `track` parameters rather than a regex of the title. Included a fallback so people using old options repos don't break. - Added a utility to capitalize the first letter of a string. Used to convert the `time` and `track` parameters when output as a title.

ZachTRiced80973887cce
diff --git a/web/js/layers/wv.layers.modal.js b/web/js/layers/wv.layers.modal.js
index 005f6f884..1654950b2 100644
--- a/web/js/layers/wv.layers.modal.js
+++ b/web/js/layers/wv.layers.modal.js
@@ -508,9 +508,24 @@ wv.layers.modal = wv.layers.modal || function(models, ui, config) {
.append($label);
// If this is an orbit track.... put it in the orbit track list
- if (layer.title.indexOf("Orbital Track") !== -1) {
+ if (layer.layergroup && layer.layergroup.indexOf("reference_orbits") !== -1) {
var orbitTitle;
+ if (layer.time && layer.track) {
+ orbitTitle = wv.util.capitalizeFirstLetter(layer.time) + "/" + wv.util.capitalizeFirstLetter(layer.track);
+ }
+
+ $label.empty()
+ .text(orbitTitle);
+ $sourceOrbits.append($wrapper);
+
+ /**
+ * @deprecated since version 1.8.0 If the data set is old and doesn't have
+ * layergroup's set then we will need to track the layer title to determine
+ * if it is a Orbital Track
+ */
+ } else if (layer.title.indexOf("Orbital Track") !== -1) {
+
// The following complex if statement is a placeholder
// for truncating the layer names, until the rest of
// the interface is implemented
diff --git a/web/js/layers/wv.layers.model.js b/web/js/layers/wv.layers.model.js
index c872166fa..8c3f10f4a 100644
--- a/web/js/layers/wv.layers.model.js
+++ b/web/js/layers/wv.layers.model.js
@@ -41,29 +41,59 @@ wv.layers.model = wv.layers.model || function(models, config) {
}
};
+
+ /**
+ * Map source descriptions to the layer objects based on their measurement relationship.
+ * There is a special check for Orbit Tracks since these layers are attached
+ * to sources in multiple measurment files.
+ * @deprecated since version 1.8.0 - Add a description flag to individual layer option files
+ *
+ * @return {type}
+ */
self.addDescriptions = function() {
var thisSetting;
var description;
_.each(config.measurements, function(measurement, measurementKey) {
- _.each(measurement.sources, function(source, sourceKey) {
- _.each(source.settings, function(setting, settingKey) {
- thisSetting = setting;
- description = source.description;
- _.each(config.layers, function(layer, layerKey) {
- // If a layer is an orbit track (based on layer title)
- if (layer.title.indexOf("Orbital Track") !== -1) {
- // And if a source is a
- if (source.title.indexOf("Space-Track.org") !== -1) {
+ if(measurementKey == "Orbital Track") {
+ _.each(measurement.sources, function(source, sourceKey) {
+ _.each(source.settings, function(setting, settingKey) {
+ thisSetting = setting;
+ description = source.description;
+ _.each(config.layers, function(layer, layerKey) {
+ // If a layer is an orbit track
+ if (layer.layergroup && layer.layergroup.indexOf("reference_orbits") !== -1) {
+ // Set the description
if (layer.id == thisSetting) {
- layer.description = description || "";
+ // If there has not been a layer description set in the file, then set it based on measurement description.
+ if(!layer.description) {
+ layer.description = description || "";
+ }
}
}
- } else if (layer.id == thisSetting) {
- layer.description = description || "";
- }
+ });
});
});
- });
+ } else {
+ _.each(measurement.sources, function(source, sourceKey) {
+ _.each(source.settings, function(setting, settingKey) {
+ thisSetting = setting;
+ description = source.description;
+ _.each(config.layers, function(layer, layerKey) {
+ if (layer.layergroup && layer.layergroup.indexOf("reference_orbits") !== -1) {
+ // Do nothing
+ } else {
+ // If a layer is not an orbit track
+ if (layer.id == thisSetting) {
+ // If there has not been a layer description set in the file, then set it based on measurement description.
+ if(!layer.description) {
+ layer.description = description || "";
+ }
+ }
+ }
+ });
+ });
+ });
+ }
});
};
diff --git a/web/js/util/wv.util.js b/web/js/util/wv.util.js
index add7062d6..6e41d8bf2 100644
--- a/web/js/util/wv.util.js
+++ b/web/js/util/wv.util.js
@@ -807,6 +807,11 @@ wv.util = (function(self) {
return value;
};
+
+ self.capitalizeFirstLetter = function(string) {
+ return string.charAt(0).toUpperCase() + string.slice(1);
+ };
+
return self;
})(wv.util || {});