Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Updated to handle WMTS "style" and "matrixIDs" parameters from layer configuration

Ryan Bollere7bd4d1ee70a
diff --git a/web/js/map/wv.map.layerbuilder.js b/web/js/map/wv.map.layerbuilder.js
index f61ca4263..bb17699b9 100644
--- a/web/js/map/wv.map.layerbuilder.js
+++ b/web/js/map/wv.map.layerbuilder.js
@@ -29,7 +29,7 @@ wv.map.layerbuilder = wv.map.layerbuilder || function(models, config, cache, Par
* @static
*
* @param {object} def - Layer Specs
- *
+ *
* @param {object} options - Layer options
*
*
@@ -129,7 +129,7 @@ wv.map.layerbuilder = wv.map.layerbuilder || function(models, config, cache, Par
* @static
*
* @param {object} def - Layer Specs
- *
+ *
* @param {object} options - Layer options
*
*
@@ -149,12 +149,19 @@ wv.map.layerbuilder = wv.map.layerbuilder || function(models, config, cache, Par
if ( !matrixSet ) {
throw new Error(def.id + ": Undefined matrix set: " + def.matrixSet);
}
- matrixIds = [];
- _.each(matrixSet.resolutions, function(resolution, index) {
- matrixIds.push(index);
- });
+ if ("undefined" === typeof def.matrixIds) {
+ matrixIds = [];
+ _.each(matrixSet.resolutions, function(resolution, index) {
+ matrixIds.push(index);
+ });
+ }
+ else {
+ matrixIds = def.matrixIds;
+ }
+
extra = "";
- if(day) {
+
+ if(day) {
if(day === 1){
extent = [-250, -90, -180, 90];
start = [-540,90];
@@ -163,6 +170,17 @@ wv.map.layerbuilder = wv.map.layerbuilder || function(models, config, cache, Par
start = [180,90];
}
}
+
+ // FIXME: use maxExtent or similar instead
+ // FIXME again: this block is currently only caught with
+ // gpw-v4-population-count_2020 in order to adjust the origin
+ if ("undefined" !== typeof def.extent) {
+ extent = def.extent;
+ start = [-180.0, 166.2144661912999];
+
+ // for GIBS, the origin is [-180,90], extent is [-180, -90, 180, 90]
+ }
+
if ( def.period === "daily" ) {
date = options.date || models.date.selected;
if(day) {
@@ -183,7 +201,7 @@ wv.map.layerbuilder = wv.map.layerbuilder || function(models, config, cache, Par
tileSize: matrixSet.tileSize[0],
}),
wrapX: false,
- style: 'default'
+ style: "undefined" === typeof def.style ? 'default' : def.style
};
if ( models.palettes.isActive(def.id) ) {
var lookup = models.palettes.getLookup(def.id);
@@ -203,7 +221,7 @@ wv.map.layerbuilder = wv.map.layerbuilder || function(models, config, cache, Par
* @static
*
* @param {object} def - Layer Specs
- *
+ *
* @param {object} options - Layer options
*
*
@@ -222,7 +240,7 @@ wv.map.layerbuilder = wv.map.layerbuilder || function(models, config, cache, Par
transparent = ( def.format === "image/png" );
if(proj.id === "geographic") {
- res = [0.28125, 0.140625, 0.0703125, 0.03515625, 0.017578125, 0.0087890625, 0.00439453125, 0.002197265625, 0.0010986328125, 0.00054931640625, 0.00027465820313];
+ res = [0.28125, 0.140625, 0.0703125, 0.03515625, 0.017578125, 0.0087890625, 0.00439453125, 0.002197265625, 0.0010986328125, 0.00054931640625, 0.00027465820313];
}
if(day) {
if(day === 1){
@@ -302,4 +320,4 @@ wv.map.layerbuilder = wv.map.layerbuilder || function(models, config, cache, Par
};
self.init(Parent);
return self;
-};
\ No newline at end of file
+};