Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

WV-190: Bug was introduced when adding handling for TWMS

Mike McGann909aebac0d40
diff --git a/js/Worldview/Map/DailyProduct.js b/js/Worldview/Map/DailyProduct.js
index c0771d959..3da405ba0 100644
--- a/js/Worldview/Map/DailyProduct.js
+++ b/js/Worldview/Map/DailyProduct.js
@@ -179,11 +179,9 @@ Worldview.Map.DailyProduct = function(map, config) {
currentLayer = cachedLayers[currentDay];
delete cachedLayers[currentDay];
} else {
- var additionalOptions = null;
+ var additionalOptions = {};
if ( lookupTable !== null ) {
- additionalOptions = {
- tileClass: Worldview.Map.CanvasTile
- };
+ additionalOptions.tileClass = Worldview.Map.CanvasTile;
}
currentLayer = self.createLayer(additionalOptions, currentDay);
if ( lookupTable !== null ) {
diff --git a/js/Worldview/Map/Product.js b/js/Worldview/Map/Product.js
index 915fb87f8..d5152d409 100644
--- a/js/Worldview/Map/Product.js
+++ b/js/Worldview/Map/Product.js
@@ -75,44 +75,37 @@ Worldview.Map.Product = function(c) {
properties = $.extend(true, {}, config.properties,
additionalProperties);
}
+ var layer;
if ( config.type === "wms" ) {
- if ( day ) {
- config.parameters.time = day;
- }
// HACK
// TWMS requires an exact order for the parameters. Rebuild the
// parameter object and ensure the correct order.
if ( config.type === "wms" ) {
var oldParameters = config.parameters;
- if ( oldParameters.time ) {
- config.parameters = {
- time: oldParameters.time,
- layers: oldParameters.layers,
- format: oldParameters.format
- };
- } else {
- config.parameters = {
- layers: oldParameters.layers,
- format: oldParameters.format
- };
- }
+ config.parameters = {
+ layers: oldParameters.layers,
+ format: oldParameters.format
+ };
$.each(oldParameters, function(key, value) {
- if ( key !== "layers" && key !== "format"
- && key !== "time") {
+ if ( key !== "layers" && key !== "format") {
config.parameters[key] = value;
}
});
}
- return new OpenLayers.Layer.WMS(config.name, config.url,
+ layer = new OpenLayers.Layer.WMS(config.name, config.url,
config.parameters, properties);
} else if ( config.type === "wmts" ) {
- return new OpenLayers.Layer.WMTS(properties);
+ layer = new OpenLayers.Layer.WMTS(properties);
} else if ( config.type === "graticule" ) {
- return new Worldview.Map.GraticuleLayer(config.name,
+ layer = new Worldview.Map.GraticuleLayer(config.name,
properties);
} else {
throw new Error("Unsupported layer type: " + config.type);
}
+ if ( day ) {
+ layer.mergeNewParams({time: day});
+ }
+ return layer;
};
init();