Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

fix for gibs build

Mike McGann863f8fb13863
diff --git a/tasks/extractConfigFromWMTS.py b/tasks/extractConfigFromWMTS.py
index 3039c714c..1f9391384 100755
--- a/tasks/extractConfigFromWMTS.py
+++ b/tasks/extractConfigFromWMTS.py
@@ -138,6 +138,11 @@ def process_entry(entry, colormaps):
gc_contents = gc["Capabilities"]["Contents"]
wv_layers = wv["layers"]
+ if gc_contents is None or "Layer" not in gc_contents:
+ error_count += 1
+ sys.stderr.write("%s: ERROR: [%s] %s\n" % (prog, gc_id, "No layers"))
+ return [error_count, warning_count, layer_count]
+
if(type(gc["Capabilities"]["Contents"]["Layer"]) is OrderedDict):
gc_layer = gc["Capabilities"]["Contents"]["Layer"]
id = gc_layer["ows:Identifier"]
diff --git a/tasks/getCapabilities.py b/tasks/getCapabilities.py
index b70d4748e..41c2a3b0a 100755
--- a/tasks/getCapabilities.py
+++ b/tasks/getCapabilities.py
@@ -70,6 +70,10 @@ def process_remote(entry):
gc = xmltodict.parse(contents)
# Find all colormaps in GetCapabilities responses and store them in memory
+ if gc["Capabilities"]["Contents"] is None:
+ print('error: %s: no layers' % url)
+ return
+
try:
if(type(gc["Capabilities"]["Contents"]["Layer"]) is OrderedDict):
process_layer(gc["Capabilities"]["Contents"]["Layer"])
@@ -77,8 +81,8 @@ def process_remote(entry):
for layer in gc["Capabilities"]["Contents"]["Layer"]:
process_layer(layer)
- except:
- print(ident)
+ except Exception as e:
+ print('error: %s: %s' % (url, str(e)))
print(str(traceback.format_exc()))
# Fetch every colormap from the API and write response to file system
diff --git a/web/js/layers/model.js b/web/js/layers/model.js
index 9ba9f6da1..a61a0f2ab 100644
--- a/web/js/layers/model.js
+++ b/web/js/layers/model.js
@@ -50,23 +50,27 @@ export function layersModel(models, config) {
};
self.getTitles = function (layerId, proj) {
- proj = proj || models.proj.selected.id;
- var title, subtitle, tags;
- if (config.layers[layerId].projections[proj]) {
- var forProj = config.layers[layerId].projections[proj];
- title = forProj.title;
- subtitle = forProj.subtitle;
- tags = forProj.tags;
+ try {
+ proj = proj || models.proj.selected.id;
+ var title, subtitle, tags;
+ if (config.layers[layerId].projections[proj]) {
+ var forProj = config.layers[layerId].projections[proj];
+ title = forProj.title;
+ subtitle = forProj.subtitle;
+ tags = forProj.tags;
+ }
+ var forLayer = config.layers[layerId];
+ title = title || forLayer.title || '[' + layerId + ']';
+ subtitle = subtitle || forLayer.subtitle || '';
+ tags = tags || forLayer.tags || '';
+ return {
+ title: title,
+ subtitle: subtitle,
+ tags: tags
+ };
+ } catch (err) {
+ throw new Error(`error in layer ${layerId}: ${err}`);
}
- var forLayer = config.layers[layerId];
- title = title || forLayer.title || '[' + layerId + ']';
- subtitle = subtitle || forLayer.subtitle || '';
- tags = tags || forLayer.tags || '';
- return {
- title: title,
- subtitle: subtitle,
- tags: tags
- };
};
self.available = function (id) {