Interactive interface for browsing global, full-resolution satellite imagery
Build can now be very tolerant for DIT environment
Mike McGanned5cc6f391c0
diff --git a/bin/wv-options-fetch b/bin/wv-options-fetchindex 2e76ff093..dfd4a3073 100755--- a/bin/wv-options-fetch+++ b/bin/wv-options-fetch@@ -50,14 +50,21 @@ def process_remote(entry):remote_count = 0error_count = 0+warning_count = 0++tolerant = config.get("tolerant", False)if "wv-options-fetch" in config:for entry in config["wv-options-fetch"]:try:remote_count += 1process_remote(entry)except Exception as e:- error_count += 1- sys.stderr.write("%s: ERROR: %s\n" % (prog, str(e)))+ if tolerant:+ warning_count += 1+ sys.stderr.write("%s: WARN: %s\n" % (prog, str(e)))+ else:+ error_count += 1+ sys.stderr.write("%s: ERROR: %s\n" % (prog, str(e)))print "%s: %d error(s), %d remote(s)" % (prog, error_count, remote_count)diff --git a/bin/wv-options-validate b/bin/wv-options-validateindex be0eb7413..919d67c63 100755--- a/bin/wv-options-validate+++ b/bin/wv-options-validate@@ -37,57 +37,74 @@ config_dir = args[1]error_count = 0warning_count = 0remove_count = 0++main_config_file = os.path.join(config_dir, "wv.json")+with open(main_config_file) as fp:+ wv = json.load(fp)+with open(options_file) as fp:+ opt = json.load(fp)-def error(message):+tolerant = opt.get("tolerant", False)++def fail(message):global error_countsys.stderr.write("%s: ERROR: %s\n" % (prog, message))error_count += 1+def error(message):+ warn(message) if tolerant else fail(message)+def warn(message):global warning_countsys.stderr.write("%s: WARN: %s\n" % (prog, message))warning_count += 1-+def remove_layer(wv, layer_id):global remove_countremove_count += 1del wv["layers"][layer_id]if layer_id in wv["layerOrder"]: wv["layerOrder"].remove(layer_id)-main_config_file = os.path.join(config_dir, "wv.json")-with open(main_config_file) as fp:- wv = json.load(fp)-with open(options_file) as fp:- opt = json.load(fp)--if "autoLayerOrder" in opt:- warn("Using automatic layer ordering")+if tolerant:+ warn("Validation enforcement disabled")for layer_id in wv["layers"].keys():layer = wv["layers"][layer_id]if layer_id not in wv["layerOrder"]:- if "autoLayerOrder" in opt:+ if tolerant:wv["layerOrder"] += [layer_id]else:- if not "allowUnexpectedLayers" in opt:- warn("[%s] Unexpected layer, not in layer order" % layer_id)+ error("[%s] Unexpected layer, not in layer order" % layer_id)remove_layer(wv, layer_id)continueif "projections" not in layer or len(layer["projections"]) == 0:- warn("[%s] No projections defined or not found in GC documents" %+ error("[%s] No projections defined or not found in GC documents" %layer_id)remove_layer(wv, layer_id)if "palette" in layer:palette_id = layer["palette"]["id"]if not os.path.exists(os.path.join(config_dir, "palettes",- palette_id + ".json")) and not "ignoreUnknownPalettes" in opt:+ palette_id + ".json")):error("[%s] Unknown palette: %s" % (layer_id, palette_id))del layer["palette"]if "group" not in layer:- if not "allowUnexpectedLayers" in opt:- error("[%s] No group defined" % palette_id)+ error("[%s] Possible unexpected layer, no group defined" % palette_id)remove_layer(wv, layer_id)continue+ for proj_id in layer["projections"].keys():+ projection = layer["projections"][proj_id]+ if "matrixSet" in projection:+ source = projection["source"]+ matrix_set = projection["matrixSet"]+ if source not in wv["sources"]:+ error("[%s:%s] Invalid source: %s" %+ (layer_id, proj_id, source))+ del layer["projections"][proj_id]+ elif matrix_set not in wv["sources"][source]["matrixSets"]:+ error("[%s:%s] Invalid matrix set: %s" %+ (layer_id, proj_id, matrix_set))+ del layer["projections"][proj_id]+for layer_id in wv["layerOrder"]:if layer_id not in wv["layers"]:diff --git a/bin/wv-options-wmts b/bin/wv-options-wmtsindex 75c90b7bb..19cbc81c9 100755--- a/bin/wv-options-wmts+++ b/bin/wv-options-wmts@@ -40,6 +40,7 @@ colormaps_dir = args[3]with open(config_file) as fp:config = json.load(fp)+tolerant = config.get("tolerant", False)if not "wv-options-wmts" in config:sys.exit(0)@@ -136,8 +137,18 @@ def process_entry(entry, colormaps):}input_file = os.path.join(input_dir, entry["from"])- with open(input_file) as fp:- xml = fp.read()+ try:+ with open(input_file) as fp:+ xml = fp.read()+ except Exception as e:+ if tolerant:+ sys.stderr.write("%s: WARN: No GC file: %s" % (prog, input_file))+ warning_count += 1+ else:+ sys.stderr.write("%s: ERROR: No GC file: %s" % (prog, input_file))+ error_count += 1+ return [error_count, warning_count, layer_count]+gc = xmltodict.parse(xml)gc_contents = gc["Capabilities"]["Contents"]diff --git a/src/js/map/wv.map.ui.js b/src/js/map/wv.map.ui.jsindex d645d2406..043adebc1 100644--- a/src/js/map/wv.map.ui.js+++ b/src/js/map/wv.map.ui.js@@ -365,6 +365,9 @@ wv.map.ui = wv.map.ui || function(models, config) {var proj = models.proj.selected;var source = config.sources[def.source];var matrixSet = source.matrixSets[def.matrixSet];+ if ( !matrixSet ) {+ throw new Error("Matrix set undefined: " + def.matrixSet);+ }var param = {url: source.url,layer: def.layer || def.id,diff --git a/src/js/wv.debug.js b/src/js/wv.debug.jsindex 5f08404c7..01799227c 100644--- a/src/js/wv.debug.js+++ b/src/js/wv.debug.js@@ -228,6 +228,9 @@ wv.debug.layers = wv.debug.layers || function(ui, models, config) {};var updateLayers = function() {+ if ( !$(this).val() ) {+ return;+ }var layerId = decodeURIComponent($(this).val());var names = models.layers.getTitles(layerId);console.log(names.title + "; " + names.subtitle);