Interactive interface for browsing global, full-resolution satellite imagery
Documentation and testing for Scheduler
Mike McGann61f3ac863771
diff --git a/build.xml b/build.xmlindex 3845e5d51..f3a19cdc5 100644--- a/build.xml+++ b/build.xml@@ -204,8 +204,7 @@<fileset dir="${build.web.js.dir}"><include name="**/*.js"/><!-- Web worker needs to load this directly, leave it around -->- <exclude name="**/TileWorker.js"/>- <exclude name="**/TileRenderer.js"/>+ <exclude name="**/LookupWorker.js"/></fileset></delete>diff --git a/doc/NaturalDocs/Menu.txt b/doc/NaturalDocs/Menu.txtindex 0531af446..3ce1b6715 100644--- a/doc/NaturalDocs/Menu.txt+++ b/doc/NaturalDocs/Menu.txt@@ -82,6 +82,7 @@ Group: Code Reference {File: CanvasTile (/Users/jmcgann/Code/Aptana/worldview/js/Worldview/Map/CanvasTile.js)File: DailyProduct (/Users/jmcgann/Code/Aptana/worldview/js/Worldview/Map/DailyProduct.js)+ File: LookupWorker (/Users/jmcgann/Code/Aptana/worldview/js/Worldview/Map/LookupWorker.js)File: Product (/Users/jmcgann/Code/Aptana/worldview/js/Worldview/Map/Product.js)File: ProductMap (/Users/jmcgann/Code/Aptana/worldview/js/Worldview/Map/ProductMap.js)File: StaticProduct (/Users/jmcgann/Code/Aptana/worldview/js/Worldview/Map/StaticProduct.js)@@ -106,6 +107,7 @@ Group: Code Reference {File: WorldviewMap (no auto-title, /Users/jmcgann/Code/Aptana/worldview/js/Worldview/Widget/WorldviewMap.js)} # Group: Widget+ File: Scheduler (/Users/jmcgann/Code/Aptana/worldview/js/Worldview/Scheduler.js)} # Group: WorldviewGroup: TestSuite {diff --git a/doc/NaturalDocs/Topics.txt b/doc/NaturalDocs/Topics.txtindex 905270f0e..21235f826 100644--- a/doc/NaturalDocs/Topics.txt+++ b/doc/NaturalDocs/Topics.txt@@ -79,3 +79,7 @@ Format: 1.52# If you add something that you think would be useful to other developers# and should be included in Natural Docs by default, please e-mail it to# topics [at] naturaldocs [dot] org.+++Alter Topic Type: Function+diff --git a/index.html b/index.htmlindex ba1f8a8d3..decb9dc4c 100644--- a/index.html+++ b/index.html@@ -53,7 +53,7 @@<!-- JavaScript resources ============================================= --><!-- <script type="text/javascript" src="js/worldview-min.js?v=@BUILD_NONCE@&mobile"></script> -->-+<!-- Dependency --><!-- js.dev --> <script src="js/ext/yui/yahoo-min.js" ></script>diff --git a/js/Logging.js b/js/Logging.jsindex 195566e1a..2918e7529 100644--- a/js/Logging.js+++ b/js/Logging.js@@ -11,23 +11,26 @@/*** Namespace: Logging- * Simple logging utility.+ * Simple logging utility.*- * For basic logging* (begin code)- * var log = Logger.getLogger()+ * var log = Logging.getLogger()* log.message("This is a message");* (end code)*- * For debugging messages that can be turned on and off+ * Debug messages can be turned on or off* (begin code)* var log = Logger.getLogger()* log.debug("This is not printed");- * Logging.debug()+ *+ * Logging.debug();* log.debug("This is printed");+ *+ * Logging.undebug();+ * log.debug("This is not printed");* (end code)*- * Assign names to loggers to turn debug logging on or off for certain loggers.+ * Assign names to loggers* (begin code)* var logA = Logger.getLogger("A");* var logB = Logger.getLogger("B");@@ -45,59 +48,91 @@*/(function(ns) {- var debugging = {};var loggers = {};+ var debugAll = false;- ns.getLogger = function(namespace) {+ /**+ * Function: getLogger+ * Gets the logger with the specified name. If a logger with that name+ * does not exist, one is created.+ *+ * Parameters:+ * name - Name of the logger to get. If not specified, the unnamed logger+ * is returned.+ *+ * Returns:+ * The <Logger> for the given name.+ */+ ns.getLogger = function(name) {var logger = null;- if ( namespace in loggers ) {- logger = loggers[namespace];+ name = name || "";+ if ( name in loggers ) {+ logger = loggers[name];} else {logger = Logger();- loggers[namespace] = logger;+ loggers[name] = logger;+ }+ if ( debugAll ) {+ logger.setDebugEnabled(true);}return logger;}/*** Function: debug- * Enables debug logging.+ * Turns on logging of debug messages.** Parameters:- * namespace - If specified, this enables debug logging for all <Loggers>- * with the given namespace. If not specified, this enables debug logging+ * name - If specified, this enables debug logging for the <Logges>+ * with the given name. If not specified, this enables debug logging* for all <Loggers>.*/- ns.debug = function(namespace) {- ns.getLogger(namespace).setDebugEnabled(true);+ ns.debug = function(name) {+ if ( name ) {+ ns.getLogger(name).setDebugEnabled(true);+ } else {+ $.each(loggers, function(name, logger) {+ logger.setDebugEnabled(true);+ });+ debugAll = true;+ }};/*** Function: undebug- * Disables debug logging.+ * Turns off logging of debug messages.** Parameters:- * namespace - If specified, this disables logging for all <Loggers>- * with the given namespace. If not specified, this disables debug logging- * for all <Loggers> except for those explicitly enabled.+ * namespace - If specified, this disables logging for the <Logger>+ * with the given name. If not specified, this disables debug logging+ * for all <Loggers>.*/- ns.undebug = function(namespace) {- ns.getLogger(namespace).setDebugEnabled(false);+ ns.undebug = function(name) {+ if ( name ) {+ ns.getLogger(name).setDebugEnabled(false);+ } else {+ $.each(loggers, function(name, logger) {+ logger.setDebugEnabled(false);+ });+ debugAll = false;+ }};+ /*+ * Clears out all the known loggers, useful for testing.+ */+ ns.reset = function() {+ loggers = {}+ }+/**- * Class: Logging.getLogger- * Sample logger- *- * Constructor: Logger- * Creates a new instance.- *- * Parameters:- * namespace - The name given to this logger.+ * Class: Logging.Logger+ * Logging methods.*/var Logger = function() {var self = {};+ var debugEnabled = false;/*** Method: message@@ -107,8 +142,8 @@* Parameters:* message - The message to print to the console.*/- self.message = ( console && console.log )- ? console.log.bind(console) : function() {};+ self.message = ( !console || !console.log )+ ? function() {} : console.log.bind(console);/*** Method: error@@ -119,8 +154,8 @@* Parameters:* message - The message to print to the console.*/- self.error = console.error- ? console.error.bind(console) : self.mesesage;+ self.error = ( !console || !console.error )+ ? self.message: console.error.bind(console);/*** Method: warn@@ -131,8 +166,8 @@* Parameters:* message - The message to print to the console.*/- self.warn = console.warn- ? console.warn.bind(console) : self.message;+ self.warn = ( !console || !console.warn )+ ? self.message : console.warn.bind(console);/*** Method: info@@ -143,36 +178,56 @@* Parameters:* message - The message to print to the console.*/- self.info = console.info- ? console.info.bind(console) : self.message;+ self.info = ( !console || !console.info )+ ? self.message : console.info.bind(console);/*** Method: trace* Prints a stack trace to the console. If console.trace does not* exist, this method does nothing.*/- self.trace = console.trace || function() {}+ self.trace = ( !console || !console.trace )+ ? function() {} : console.trace;/*** Method: debug* Prints a debug message to the console if debugging is enabled.- * Debugging can be enabled by calling Logging.debug with the namespace- * of this logger, or by calling Logging.debug with no parameters.- * If the console object does not exist, this method does nothin.+ * Debugging can be enabled by calling Logging.debug with the name+ * of this logger, by calling Logging.debug with no parameters,+ * or by calling setDebugEnabled on this logger. If the console object+ * does not exist, this method does nothing.** Parameters:* message - The message to print to the console.*/self.debug = function() {};+ /**+ * Method: setDebugEnabled+ * Enables or disables logging of debug messages.+ *+ * Parameters:+ * enabled - if true, enables debug messages.+ */self.setDebugEnabled = function(enabled) {if ( enabled ) {self.debug = self.message;} else {self.debug = function() {};}+ debugEnabled = enabled;};+ /**+ * Method: isDebugEnabled+ *+ * Returns:+ * true if debug messages will be printed to the console, otherwise+ * returns false.+ */+ self.isDebugEnabled = function() {+ return debugEnabled;+ }return self;};diff --git a/js/Worldview.js b/js/Worldview.jsindex f091191e2..7587a0044 100644--- a/js/Worldview.js+++ b/js/Worldview.js@@ -2,9 +2,7 @@* Namespace: Worldview*/(function(ns) {-- var log = Logging.getLogger("Worldview");-+/*** Constant: NAME* Official name of this application.@@ -70,11 +68,13 @@* caught.*/ns.error = function(message, cause) {- log.error(message);+ var log = Logging.getLogger();if ( cause ) {log.error(cause);- }-+ } else {+ log.error(message);+ }+if ( window.YAHOO && window.YAHOO.widget &&window.YAHOO.widget.Panel ) {o = new YAHOO.widget.Panel("WVerror", {@@ -103,7 +103,7 @@* title will be "Notice".*/ns.notify = function(message, title) {- log.info(message);+ Logging.getLogger().info(message);if ( window.YAHOO && window.YAHOO.widget &&window.YAHOO.widget.Panel ) {diff --git a/js/Worldview/Map.js b/js/Worldview/Map.jsindex b81db8d89..f8621ea18 100644--- a/js/Worldview/Map.js+++ b/js/Worldview/Map.js@@ -65,6 +65,6 @@ $(function(ns) {return valid;};- ns.tileScheduler = Worldview.Scheduler("js/Worldview/Map/TileWorker.js", 4);+ ns.tileLookupScheduler = null;}(Worldview.Map));diff --git a/js/Worldview/Map/CanvasTile.js b/js/Worldview/Map/CanvasTile.jsindex fea9278c6..136690c17 100644--- a/js/Worldview/Map/CanvasTile.js+++ b/js/Worldview/Map/CanvasTile.js@@ -52,7 +52,7 @@ Worldview.Map.CanvasTile = OpenLayers.Class(OpenLayers.Tile.Image, {* when clear() is invoked.*/canvas: null,- cavansOriginal: null,+ canvasOriginal: null,graphics: null,grpahicsOriginal: null,latestJobId: null,@@ -151,19 +151,24 @@ Worldview.Map.CanvasTile = OpenLayers.Class(OpenLayers.Tile.Image, {var self = results.self;var canvas = self.canvas;if ( !canvas || results.id !== self.latestJobId ) {- return;+ self.log.debug(self.id + ": Discarding stale tile");+ } else if ( results.status === "cancelled" ) {+ self.log.debug(self.id + ": Cancelled");+ } else if ( results.status === "error" ) {+ self.log.error(self.id + ": Unable to render tile");+ } else if ( results.status === "success" ){+ var imageData = results.message.destination;+ self.graphics.putImageData(imageData, 0, 0);+ canvas.style.visibility = "inherit";+ canvas.style.opacity = self.layer.opacity;+ self.canvasContext = null;+ self.log.debug(self.id + ": rendered");+ } else {+ throw new Error("Invalid status during tile rendering: " ++ results.status);}- self.log.debug("latestJobId: " + self.latestJobId + ", results.id" + results.id);- var imageData = results.message.destination;-- self.graphics.putImageData(imageData, 0, 0);-- canvas.style.visibility = "inherit";- canvas.style.opacity = self.layer.opacity;- self.canvasContext = null;self.isLoading = false;self.events.triggerEvent("loadend");- self.log.debug(self.id + ": rendered");},applyLookup: function(imageLoaded) {@@ -175,8 +180,6 @@ Worldview.Map.CanvasTile = OpenLayers.Class(OpenLayers.Tile.Image, {return;}this.isLoading = true;- //this.canvas.style.visibility = "hidden";- //this.canvas.style.opacity = 0;var lookupTable = this.layer.lookupTable;var source = this.graphicsOriginal.getImageData(0, 0, this.canvas.width,@@ -184,7 +187,7 @@ Worldview.Map.CanvasTile = OpenLayers.Class(OpenLayers.Tile.Image, {var destination = this.graphics.getImageData(0, 0, this.canvas.width,this.canvas.height);- this.latestJobId = Worldview.Map.tileScheduler.submit({+ this.latestJobId = Worldview.Map.tileLookupScheduler.submit({message: {lookupTable: lookupTable,source: source,diff --git a/js/Worldview/Map/LookupWorker.js b/js/Worldview/Map/LookupWorker.jsnew file mode 100644index 000000000..29a0e4ad9--- /dev/null+++ b/js/Worldview/Map/LookupWorker.js@@ -0,0 +1,81 @@+/*+ * NASA Worldview+ *+ * This code was originally developed at NASA/Goddard Space Flight Center for+ * the Earth Science Data and Information System (ESDIS) project.+ *+ * Copyright (C) 2013 United States Government as represented by the+ * Administrator of the National Aeronautics and Space Administration.+ * All Rights Reserved.+ */++/**+ * Namespace: Worldview.Map.LookupWorker+ * Performs the task of applying a color lookup table from a source tile+ * to a destination tile.+ *+ * This script is meant to be used from within a web worker and should not+ * be concatentated with other JavaScript files.+ *+ * The following commands are accepted in event.data.command+ *+ * - execute: Starts work. Requires an <Execute> object to be passed in as the+ * message.+ * - cancel: Cancelles any outstanding work as soon as possible. No message+ * object is required.+ *+ * Class: Worldview.Map.LookupWorker.Execute+ * The execute command requires the following object to be found in+ * event.data.message+ *+ * Property: lookupTable+ * The lookup table to apply+ *+ * Property: source+ * The canvas image data pixels that are used to lookup in the table.+ *+ * Property: destination+ * The taget canvs image data pixels that the new color will be applied ot.+ *+ */+var cancelled = false;++var execute = function(event) {+ var message = event.data.message;+ var lookupTable = message.lookupTable;++ // Get pixel data from the imageData objects+ var source = message.source.data;+ var destination = message.destination.data;++ for ( var i = 0; i < source.length; i += 4 ) {+ var lookup = source[i + 0] + "," ++ source[i + 1] + "," ++ source[i + 2] + "," ++ source[i + 3];+ var color = lookupTable[lookup];+ if ( color ) {+ destination[i + 0] = color.r+ destination[i + 1] = color.g+ destination[i + 2] = color.b+ destination[i + 3] = 0xff;+ }+ if ( cancelled ) {+ break;+ }+ }+ event.data.status = cancelled ? "cancel" : "success";+ self.postMessage(event.data);+};++self.addEventListener("message", function(event) {+ if ( event.data.command === "execute" ) {+ cancelled = false;+ execute(event);+ } else if ( event.data.command === "cancel" ) {+ cancelled = true;+ } else {+ throw new Error("Invalid command: " + event.data.commmand);+ }+}, false);+diff --git a/js/Worldview/Map/PaletteSupport.js b/js/Worldview/Map/PaletteSupport.jsdeleted file mode 100644index 157363434..000000000--- a/js/Worldview/Map/PaletteSupport.js+++ /dev/null@@ -1,12 +0,0 @@--(function(ns) {-- ns.repaint = function(layer) {- $.each(layer.grid, function(index, row) {- $.each(row, function(index, tile) {- tile.repaint();- });- });- };--})(Worldview.Map.PaletteSupport);diff --git a/js/Worldview/Map/TileRenderer.js b/js/Worldview/Map/TileRenderer.jsdeleted file mode 100644index 523e2976d..000000000--- a/js/Worldview/Map/TileRenderer.js+++ /dev/null@@ -1,38 +0,0 @@-/*- * NASA Worldview- *- * This code was originally developed at NASA/Goddard Space Flight Center for- * the Earth Science Data and Information System (ESDIS) project.- *- * Copyright (C) 2013 United States Government as represented by the- * Administrator of the National Aeronautics and Space Administration.- * All Rights Reserved.- */--if ( !Worldview ) {- var Worldview = {};-}-Worldview.Map = Worldview.Map || {};-Worldview.Map.TileRenderer = Worldview.Map.TileRenderer || {};--Worldview.Map.TileRenderer.renderLookup = function(lookupTable, source,- destination) {-- var s = source.data;- var d = destination.data;-- for ( var i = 0; i < s.length; i += 4 ) {- var lookup = s[i + 0] + "," +- s[i + 1] + "," +- s[i + 2] + "," +- s[i + 3];- var color = lookupTable[lookup];- if ( color ) {- d[i + 0] = color.r- d[i + 1] = color.g- d[i + 2] = color.b- d[i + 3] = 0xff;- }- };--}diff --git a/js/Worldview/Map/TileWorker.js b/js/Worldview/Map/TileWorker.jsdeleted file mode 100644index bfe8f9a03..000000000--- a/js/Worldview/Map/TileWorker.js+++ /dev/null@@ -1,33 +0,0 @@--importScripts("TileRenderer.js");--var handleEvent = function(event) {- var message = event.data.message;- var lookupTable = message.lookupTable;- var source = message.source;- var destination = message.destination;-- Worldview.Map.TileRenderer.renderLookup(lookupTable, source, destination);-- /*- for ( var i = 0; i < pixels.length; i += 4 ) {- var lookup = pixels[i + 0] + "," +- pixels[i + 1] + "," +- pixels[i + 2] + "," +- pixels[i + 3];- var color = lookupTable[lookup];- if ( color ) {- pixels[i + 0] = color.r- pixels[i + 1] = color.g- pixels[i + 2] = color.b- pixels[i + 3] = 0xff;- }- }- */- self.postMessage(event.data);-};--self.addEventListener("message", function(event) {- handleEvent(event);-}, false);-diff --git a/js/Worldview/Scheduler.js b/js/Worldview/Scheduler.jsindex deffb42fe..c04780615 100644--- a/js/Worldview/Scheduler.js+++ b/js/Worldview/Scheduler.js@@ -1,122 +1,251 @@+/*+ * NASA Worldview+ *+ * This code was originally developed at NASA/Goddard Space Flight Center for+ * the Earth Science Data and Information System (ESDIS) project.+ *+ * Copyright (C) 2013 United States Government as represented by the+ * Administrator of the National Aeronautics and Space Administration.+ * All Rights Reserved.+ */-Worldview.Scheduler = function(workerScript, maxJobs) {+/**+ * Class: Worldview.Scheduler+ * Executes jobs in web workers and queues requests if busy.+ *+ * Logger:+ * Worldview.Scheduler+ *+ * Constructor: Scheduler+ * Creates a new instance.+ *+ * Parameters:+ * config.script - The path to the script that contains the code for the+ * web worker. This path should be relative to the application+ * root.+ * config.max - Number of workers to start. Requests up to this number can+ * run concurrently--after this jobs are queued.+ * config.factory - Use this function to create web workers instead of invoking+ * new directly.+ *+ */+Worldview.Scheduler = function(config) {var log = Logging.getLogger("Worldview.Scheduler");var self = {};++ // Array of web workers equal to the size of maxWorkersvar workers = [];++ // For each worker, contains the job identifier that is currently being+ // executed+ var jobExecuting = [];++ // Jobs which cannot be submitted immedately are placed in this queyue.var queue = [];++ // Each job is assigned an ID. This holds the next available number.var nextId = 1;++ // Information about jobs being tracked is place here keyed by jobId.+ // Includes:+ // jobId: job identifier+ // callback: callback to be invoked after work has completed.+ // creationTime: time in ms that the job was submitted.+ // queuedTime: time in ms that the job entered the queue.+ // postedTime: time in ms that the job was posted to the worker for+ // execution.var jobs = {};++ // Number of jobs that are currently being executedvar executing = 0;- var maxJobs = maxJobs || 1;- var supportsTransferables = true;+ // Number of workers to start+ var maxWorkers = maxWorkers || 1;++ //-------------------------------------------------------------------------+ // Public+ //-------------------------------------------------------------------------+var init = function() {- //Logging.debug("Worldview.Scheduler");- for ( var i = 0; i < maxJobs; i++ ) {- var worker = new Worker(workerScript);- worker.addEventListener("message", onWorkComplete, false);+ var factory = config.factory || function() {+ return new Worker(config.script);+ }+ var max = config.max || 1;++ for ( var i = 0; i < max; i++ ) {+ var worker = factory(config.script);+ worker.addEventListener("message", onSuccess, false);worker.addEventListener("error", onError, false);- workers[i] = worker;+ workers[i] = worker;+ // Attach the index of the worker itself to the worker. This is+ // useful for identifying the correct worker on an error event.+ workers[i].id = i;}};-- var endOfWorkStatistics = function(job) {- var stats = self.stats;- var endTime = new Date().getTime();- var totalTime = endTime - job.creationTime;- var executionTime = endTime - job.postedTime;-- stats.executed++;- var previousRatio = (stats.executed - 1) / stats.executed;- var thisRatio = 1 / stats.executed;-- stats.averageTime =- (stats.averageTime * previousRatio) + (totalTime * thisRatio);- stats.maximumTime =- Math.max(totalTime, stats.maximumTime);- stats.averageExecutionTime =- (stats.averageExecutionTime * previousRatio) +- (executionTime * thisRatio);- stats.maximumExecutionTime =- Math.max(executionTime, stats.maximumExecutionTime);- var queueTime = 0;- if ( job.queuedTime ) {- queueTime = job.postedTime - job.queuedTime;- previousRatio = (stats.queued - 1) / stats.queued;- thisRatio = 1 / stats.queued;-- stats.averageQueueTime =- (stats.averageQueueTime * previousRatio) +- (queueTime * thisRatio);- stats.maximumQueueTime =- Math.max(stats.maximumQueueTime, queueTime);- }- log.debug("Job " + job.id + ": total " + totalTime + "ms, queue " +- queueTime + "ms, execution " + executionTime + "ms");- }+ /**+ * Property: profile+ * If true, statistics are collected in the <stats> property.+ */+ self.profile = false;- var onWorkComplete = function(event) {- executing--;- var results = event.data;- var timingInfo = "";- var job = jobs[results.id];+ /**+ * Property: stats+ * If <profile> is set to true, <Stats> will be collected in this object.+ */+ self.stats = {+ queued: 0,+ executed: 0,+ averageTime: 0.0,+ maximumTime: 0,+ averageQueueTime: 0.0,+ maximumQueueTime: 0.0,+ averageExecutionTime: 0.0,+ maximumExecutionTime: 0.0,+ };++ /**+ * Function: submit+ *+ * Submit a job to be executed when a worker becomes available.+ *+ * Parameters:+ * spec.message - Data sent to the worker.+ * spec.callback - Callback to be executed when the job completes. The+ * callback should accept one argument, a <Results>+ * object.+ * spec.self - If needed, the this object to be returned in the+ * callback.+ *+ * Returns:+ * The numeric identifier assigned to this job.+ *+ * Throws:+ * An exception if spec.callback is not a function.+ */+ self.submit = function(spec) {+ if ( typeof spec.callback !== "function" ) {+ throw new Error("spec.callback is not defined or is not a " ++ "function");+ }++ var id = nextId++;+ var job = {+ id: id,+ message: spec.message || null,+ callback: spec.callback,+ self: spec.self || null+ };if ( self.profile ) {- endOfWorkStatistics(job);+ job.creationTime = Worldview.now();}- log.debug("Completed job " + job.id + ", backlog: " + queue.length);- jobs[results.id].callback({- id: job.id,- message: results.message,- self: jobs[results.id].self- });- delete jobs[results.id];+ jobs[id] = job;- if ( queue.length > 0 && executing < maxJobs ) {- var job = queue.shift();+ if ( executing < maxWorkers ) {execute(job);- }+ } else {+ enqueue(job);+ }+ return id;+ };++ /**+ * Function: cancel+ * Clears all jobs from the queue and messages all active works to stop.+ */+ self.cancel = function() {+ if ( log.isDebugEnabled() ) {+ $.each(job, function(index, queue) {+ log.debug("Removed job " + job.id + " from queue");+ })+ }+ queue = [];+ $.each(worker, function(jobId, workers) {+ log.debug("Cancelling job " + jobId);+ worker.postMessage({command: "cancel"});+ });};+ //-------------------------------------------------------------------------+ // Private+ //-------------------------------------------------------------------------++ /*+ * Called when the worker completes a job.+ */+ var onSuccess = function(event) {+ var results = event.data;+ log.debug("Completed job " + results.id + ", backlog: " ++ queue.length);+ notify(event, jobs[results.id]);+ };++ /*+ * Called when the worker fails due to a thrown exception.+ */var onError = function(event) {- log.error(event);+ // Grab the worker id that was stuffed into the worker object and+ // use that to lookup the job id+ workerId = event.target.id;+ jobId = jobExecuting[workerId];++ results = {+ id: jobId,+ status: "error",+ }+ event.data = results;+ log.debug("Error on job " + results.id + ": " + event.message ++ ", " + "backlog: " + queue.length);+ notify(event, jobs[results.id]);};+ /*+ * Notifies via callback that work has completed, collects statistics+ * if needed, and processes the next item in the queue.+ */+ var notify = function(event, job, callback) {+ executing--;+ if ( self.profile ) {+ collectStatistics(job);+ }+ job.callback({+ id: job.id,+ message: event.data.message,+ status: event.data.status,+ self: job.self+ });+ delete jobs[job.id];+ var workerId = event.target.id;+ delete jobExecuting[workerId];++ processQueue();+ };++ /*+ * Executes the given job in the next available web worker.+ */var execute = function(job) {var workerId = executing++;log.debug("Executing job " + job.id + ", worker " + workerId +", backlog: " + queue.length);- /*- workers[workerId].postMessage({- id: job.id,- message: job.message- }, job.transferables);- */if ( self.profile ) {- job.postedTime = new Date().getTime();+ job.postedTime = Worldview.now();}var post = {+ command: "execute",id: job.id,message: job.message,- supportsTransferables: supportsTransferables}- if ( supportsTransferables ) {- try {- workers[workerId].postMessage(post, job.transferables);- } catch ( error ) {- log.warn("Transferables unsupported: " + error);- supportsTransferables = false;- post.supportsTransferables = false;- }- }- if ( !supportsTransferables ) {- workers[workerId].postMessage(post);- }+ jobExecuting[workerId] = job.id;+ workers[workerId].postMessage(post);};+ /*+ * Places a job in the queue+ */var enqueue = function(job) {var queueLength = queue.length + 1;log.debug("Queueing job " + job.id + ", backlog: " + queueLength);@@ -127,43 +256,116 @@ Worldview.Scheduler = function(workerScript, maxJobs) {queue.push(job);};- self.profile = false;-- self.stats = {- queued: 0,- executed: 0,- averageTime: 0.0,- maximumTime: 0,- averageQueueTime: 0.0,- maximumQueueTime: 0,- averageExecutionTime: 0.0,- maximumExecutionTime: 0,+ /*+ * If the queue is not empty, dequeues the next job and executes.+ */+ var processQueue = function() {+ if ( queue.length > 0 && executing < maxWorkers ) {+ var job = queue.shift();+ execute(job);+ }};- self.submit = function(spec) {- var id = nextId++;- var job = {- id: id,- message: spec.message,- callback: spec.callback,- transferables: spec.transferables,- self: spec.self- };- if ( self.profile ) {- job.creationTime = new Date().getTime();- }- jobs[id] = job;+ /*+ * Collect statistics after a job has been executed+ */+ var collectStatistics = function(job) {+ var stats = self.stats;+ var endTime = Worldview.now();+ var totalTime = endTime - job.creationTime;+ var executionTime = endTime - job.postedTime;- if ( executing < maxJobs ) {- execute(job);- } else {- enqueue(job);- }- return id;- }-+ stats.executed++;+ var previousRatio = (stats.executed - 1) / stats.executed;+ var thisRatio = 1 / stats.executed;+ stats.averageTime =+ (stats.averageTime * previousRatio) + (totalTime * thisRatio);+ stats.maximumTime =+ Math.max(totalTime, stats.maximumTime);+ stats.averageExecutionTime =+ (stats.averageExecutionTime * previousRatio) ++ (executionTime * thisRatio);+ stats.maximumExecutionTime =+ Math.max(executionTime, stats.maximumExecutionTime);++ var queueTime = 0;+ if ( job.queuedTime ) {+ queueTime = job.postedTime - job.queuedTime;+ previousRatio = (stats.queued - 1) / stats.queued;+ thisRatio = 1 / stats.queued;++ stats.averageQueueTime =+ (stats.averageQueueTime * previousRatio) ++ (queueTime * thisRatio);+ stats.maximumQueueTime =+ Math.max(stats.maximumQueueTime, queueTime);+ }+ log.debug("Job " + job.id + ": total " + totalTime + "ms, queue " ++ queueTime + "ms, execution " + executionTime + "ms");+ };+init();return self;};++/**+ * Section: Static Functions+ *+ * Function: isSupported+ * Returns true if Worker is defined in the window object.+ */+Worldview.Scheduler.isSupported = function() {+ return window.Worker !== undefined;+}++/**+ * Class: Worldview.Scheduler.Stats+ * Contains statistics gathered from the <Scheduler> when <Scheduler.profile>+ * is set to true.+ *+ * Property: queued+ * Total number of jobs that could not be serviced immedately and were placed+ * in the queue.+ *+ * Property: executed+ * Total number of jobs that have been executed.+ *+ * Property: averageTime+ * Average time, in milliseconds, taken to complete requests.+ *+ * Property: maxmimumTime+ * Maximum time, in milliseconds, taken to complete requests.+ *+ * Property: averageQueueTime+ * Average time, in milliseconds, that jobs waited in the queue before being+ * executed.+ *+ * Property: maximumQueueTime+ * Maximum time, in milliseconds, that a job waited in the queue before being+ * executed.+ *+ * Property: averageExecutionTime+ * Average time, in milliseconds, that jobs took to execute in the web worker.+ *+ * Property: maximumExecutionTime+ * Maximum time, in milliseconds, that a job took to execute in the web worker.+ */++/**+ * Class: Worldview.Scheduler.Results+ * Object that contains information on a completed job.+ *+ * Property: id+ * The numeric identifier assigned to this job+ *+ * Property: message+ * The data content returned by the worker.+ *+ * Property: status+ * Either "success", "error", or "cancel"+ *+ * Property: self+ * If provided, the "this" context of the caller.+ */\ No newline at end of filediff --git a/js/Worldview/Support.js b/js/Worldview/Support.jsdeleted file mode 100644index e8caa6b01..000000000--- a/js/Worldview/Support.js+++ /dev/null@@ -1,48 +0,0 @@-Worldview.namespace("Support");--(function(ns) {-- ns.WEB_WORKERS = false;-- var log = Logging.getLogger();-- /*- * jQuery version 1.6 causes thousands of warnings to be emitted to the- * console on WebKit based browsers with the following message:- *- * event.layerX and event.layerY are broken and deprecated in WebKit. They- * will be removed from the engine in the near future.- *- * This has been fixed in jQuery 1.8 but Worldview currently doesn't- * support that version. This fix copied from:- *- * http://stackoverflow.com/questions/7825448/webkit-issues-with-event-layerx-and-event-layery- */- var jQueryLayerFix = function() {- // remove layerX and layerY- var all = $.event.props,- len = all.length,- res = [];- while (len--) {- var el = all[len];- if (el != 'layerX' && el != 'layerY') res.push(el);- }- $.event.props = res;- };-- var checkWebWorkers = function() {- if ( window.Worker ) {- ns.WEB_WORKERS = true;- } else {- log.warn("Web workers are not supported");- }- };-- var init = function() {- jQueryLayerFix();- checkWebWorkers();- };-- init();--})(Worldview.Support);diff --git a/js/main.js b/js/main.jsindex 3fad8fd36..da47176ff 100644--- a/js/main.js+++ b/js/main.js@@ -13,7 +13,13 @@ $(function() {// Initialize "static" vars.error(Worldview.ajaxError(onConfigLoadError));}- var onConfigLoad = function(config) {+ var init = function(config) {++ Worldview.Map.tileLookupScheduler = Worldview.Scheduler({+ script: "js/Worldview/Map/LookupWorker.js",+ max: 4+ });+selector = new YAHOO.widget.Panel("selector", { zIndex:1019, visible:false } );selector.setBody("<div id='selectorbox'></div>");selector.render(document.body);@@ -78,16 +84,48 @@ $(function() {// Initialize "static" vars}log.info(Worldview.NAME + ", Version " + Worldview.VERSION);-startTour();};+ var onConfigLoad = function(config) {+ try {+ init(config);+ } catch ( error ) {+ Worldview.error("Unable to start Worldview", error);+ }+ };+var onConfigLoadError = function(message) {Worldview.error("Unable to load configuration from server", message);};+ /*+ * jQuery version 1.6 causes thousands of warnings to be emitted to the+ * console on WebKit based browsers with the following message:+ *+ * event.layerX and event.layerY are broken and deprecated in WebKit. They+ * will be removed from the engine in the near future.+ *+ * This has been fixed in jQuery 1.8 but Worldview currently doesn't+ * support that version. This fix copied from:+ *+ * http://stackoverflow.com/questions/7825448/webkit-issues-with-event-layerx-and-event-layery+ */+ var jQueryLayerFix = function() {+ // remove layerX and layerY+ var all = $.event.props,+ len = all.length,+ res = [];+ while (len--) {+ var el = all[len];+ if (el != 'layerX' && el != 'layerY') res.push(el);+ }+ $.event.props = res;+ };+try {- entryPoint();+ jQueryLayerFix();+ entryPoint();} catch ( cause ) {Worldview.error("Failed to start Worldview", cause);}diff --git a/js/map.js b/js/map.jsdeleted file mode 100644index d28def774..000000000--- a/js/map.js+++ /dev/null@@ -1,994 +0,0 @@-SOTE.namespace("SOTE.widget.Map");-SOTE.widget.Map.prototype = new SOTE.widget.Component;---/**- * Instantiate the map- *- * @class Instantiates a map projection layered with images retrieved from the specified client- * derived from the given bounding box, date, and data product- * @constructor- * @this {map}- * @param {String} containerId is the container id of the div in which to render the object- * @param {Object} [config] is a hash allowing configuration of this component- * @config {boolean} [hasControls] whether or not the produced map should have zoom and pan controls- * @config {boolean} [isSelectable] whether or not a bounding box selection is allowed- * @config {String} [bbox] the extent of the map as w,s,e,n- * @augments SOTE.widget.Component- *-*/-SOTE.widget.Map = function(containerId, config){-- // Get the ID of the container element- this.container=document.getElementById(containerId);- if (this.container==null){- this.setStatus("Error: element '"+containerId+"' not found!",true);- return;- }-- // Store the container's ID- this.containerId=containerId;- this.id = containerId;-- //- // Constants- //- this.DEFAULT_OVERLAY_OPACITY = 0.95;-- var currentDate = new Date();- var gibsStartDate = new Date(2012, 4, 7, 0, 0, 0, 0);-- // Compute number of days by converting from ms- var numDaysToGenerate = (currentDate.getTime() - gibsStartDate.getTime()) / (24 * 60 * 60 * 1000) + 1;-- // Number of "days" to generate for each layer- this.NUM_DAYS_TO_GENERATE = Math.round(numDaysToGenerate);--- // Resolutions / zoom levels supported by the current map- this.RESOLUTIONS_ON_SCREEN_GEO_ALL =- [0.5625, 0.28125, 0.140625,- 0.0703125, 0.03515625, 0.017578125,- 0.0087890625, 0.00439453125, 0.002197265625];-- this.RESOLUTIONS_ON_SCREEN_POLAR_ALL =- [8192.0, 4096.0, 2048.0,- 1024.0, 512.0, 256.0];-- // Resolutions / zoom levels supported by the server- this.RESOLUTIONS_ON_SERVER_GEO_250m =- [0.5625, 0.28125, 0.140625,- 0.0703125, 0.03515625, 0.017578125,- 0.0087890625, 0.00439453125, 0.002197265625];-- this.RESOLUTIONS_ON_SERVER_POLAR_250m =- [8192.0, 4096.0, 2048.0,- 1024.0, 512.0, 256.0];-- this.TILEMATRIXSET_GEO_250m = "EPSG4326_250m";- this.TILEMATRIXSET_ANTARCTIC_250m = "EPSG3031_250m";- this.TILEMATRIXSET_ARCTIC_250m = "EPSG3995_250m";-- this.RESOLUTIONS_ON_SERVER_GEO_500m =- [0.5625, 0.28125, 0.140625,- 0.0703125, 0.03515625, 0.017578125,- 0.0087890625, 0.00439453125];-- this.RESOLUTIONS_ON_SERVER_POLAR_500m =- [8192.0, 4096.0, 2048.0,- 1024.0, 512.0];-- this.TILEMATRIXSET_GEO_500m = "EPSG4326_500m";- this.TILEMATRIXSET_ANTARCTIC_500m = "EPSG3031_500m";- this.TILEMATRIXSET_ARCTIC_500m = "EPSG3995_500m";--- this.RESOLUTIONS_ON_SERVER_GEO_1km =- [0.5625, 0.28125, 0.140625,- 0.0703125, 0.03515625, 0.017578125,- 0.0087890625];-- this.RESOLUTIONS_ON_SERVER_POLAR_1km =- [8192.0, 4096.0, 2048.0,- 1024.0];-- this.TILEMATRIXSET_GEO_1km = "EPSG4326_1km";- this.TILEMATRIXSET_ANTARCTIC_1km = "EPSG3031_1km";- this.TILEMATRIXSET_ARCTIC_1km = "EPSG3995_1km";--- this.RESOLUTIONS_ON_SERVER_GEO_2km =- [0.5625, 0.28125, 0.140625,- 0.0703125, 0.03515625, 0.017578125];-- this.RESOLUTIONS_ON_SERVER_POLAR_2km =- [8192.0, 4096.0, 2048.0];-- this.TILEMATRIXSET_GEO_2km = "EPSG4326_2km";- this.TILEMATRIXSET_ANTARCTIC_2km = "EPSG3031_2km";- this.TILEMATRIXSET_ARCTIC_2km = "EPSG3995_2km";--- // Define an object for holding configuration- if (config===undefined){- config={};- }-- if(config.hasControls === undefined){- config.hasControls = true;- }-- if(config.isSelectable === undefined){- config.isSelectable = false;- }-- if(config.bbox === undefined)- {- // Set default extent according to time of day:- // at 00:00 UTC, start at far eastern edge of map: "20.6015625,-46.546875,179.9296875,53.015625"- // at 23:00 UTC, start at far western edge of map: "-179.9296875,-46.546875,-20.6015625,53.015625"- var curHour = new Date().getUTCHours();-- // For earlier hours when data is still being filled in, force a far eastern perspective- if (curHour < 9)- curHour = 0;-- // Compute east/west bounds- var minLon = 20.6015625 + curHour * (-200.53125/23.0);- var maxLon = minLon + 159.328125;-- config.bbox = minLon.toString() + ",-46.546875,"+maxLon.toString()+",53.015625"; //"-148.359375,-47.25,4.78125,60.1875"; //"-175, -85, 175, 85";- }--- if(config.dataSourceUrl === undefined){- config.dataSourceUrl = null;- }-- if(config.maxWidth === undefined){- config.maxWidth = null;- }-- if(config.maxHeight === undefined){- config.maxHeight = null;- }-- if (config.layers === undefined){- config.layers = null;- }-- if (config.time === undefined)- {- config.time = new Date();- config.time = config.time.getUTCFullYear() + "-" + SOTE.util.zeroPad(eval(config.time.getUTCMonth()+1),2) + "-" +- SOTE.util.zeroPad(config.time.getUTCDate(),2) + "T" + SOTE.util.zeroPad(config.time.getUTCHours(),2) + ":" +- SOTE.util.zeroPad(config.time.getUTCMinutes(),2) + ":" + SOTE.util.zeroPad(config.time.getUTCSeconds(),2);- }-- if (config.baselayer === undefined)- {- config.baselayer = null;- }-- // this.selectionEvent = new YAHOO.util.CustomEvent("SelectionEvent",this);-- this.hasControls = config.hasControls;- this.isSelectable = config.isSelectable;- this.bbox = config.bbox;- //this.date = config.date;- this.value = "";- this.register = config.register;- this.maxWidth = config.maxWidth;- this.maxHeight = config.maxHeight;- this.dataSourceUrl = config.dataSourceUrl;- this.statusStr = "";- this.disabled = false;- this.time = config.time;- this.baseLayer = config.baseLayer;- this.graticule = null;- this.projection = "EPSG:4326";-- // Initialize the map- this.init();-- if(REGISTRY){- REGISTRY.register(this.id,this);- }- else{- alert("No REGISTRY found! Cannot register Map!");- }--- // // Load layers into memory- this.isSoteMapDataCached = false;- this.updateComponent("");-- // Set active layer if params set- if ((this.time != null) && (this.baseLayer != null))- {- this.activateRelevantLayersDisableTheRest([this.baseLayer],this.time);- }--- // Set extent- this.setExtent(this.bbox);-- // Set up callback for when pan/zoom ends to auto-call the "fire" function- //this.map.events.register("moveend", this, this.handleMapMoveEnd);-- if(REGISTRY){- REGISTRY.markComponentReady(this.id);- }-};---/**- * OpenLayers callback that's called as soon as user stops moving the map and releases- * the mouse/touch; currently used to notify all listeners that the map extent- * has changed.- */-SOTE.widget.Map.prototype.handleMapMoveEnd = function(evt)-{- var latLon = evt.object.getExtent().transform(- evt.object.getProjectionObject(),- new OpenLayers.Projection(this.projection)).toString();-- this.setValue(latLon);- this.fire();-};---/**- * Activates/enables the specified products at the specified time step; useful to- * ensure that only the currently-enabled products at the specified time are currently- * being displayed.- *- * @param an array of strings containing the currently-active product names- * @param string of desired UTC time- */-SOTE.widget.Map.prototype.activateRelevantLayersDisableTheRest = function(activeProductNames, time)-{- // Enable layers of selected Date, disable the rest- var allLayers = this.getAllLayers();- var nLayers = allLayers.length;- var myDate = SOTE.util.UTCDateFromISO8601String(time);- time = myDate.getUTCFullYear() + "-" + SOTE.util.zeroPad(eval(myDate.getUTCMonth()+1),2) + "-" + SOTE.util.zeroPad(myDate.getUTCDate(),2);- // Loop through all loaded OpenLayers layers- for (var i=0; i<nLayers; i++)- {- // Enable this layer if in list of active layers- var isLayerFound = false;- for (var j=0; j<activeProductNames.length; j++)- {- if ((allLayers[i].name == new String(activeProductNames[j] + "__" + time)) ||- (allLayers[i].name == new String(activeProductNames[j])))- {- // Assume base layer is first element of product list and force it to have the lowest z-index- // (a z-index of 0 is lowest, higher numbers are drawn on top)- // Also: Set opacity to 1.0 for base layer, a fraction of it for overlays (until controls can be made)- allLayers[i].setVisibility(true);- isLayerFound = true;-- if (j==0)- {- this.map.setLayerZIndex(allLayers[i], 0);- allLayers[i].setOpacity(1.0);- }- else- {- // Set Z-layering- /*if (this.checkWmsParam(allLayers[i].metadata.bringToFront) && allLayers[i].metadata.bringToFront)- this.map.setLayerZIndex(allLayers[i], nLayers-1);- */- // Set opacity- if (this.checkWmsParam(allLayers[i].metadata.preferredOpacity))- allLayers[i].setOpacity(allLayers[i].metadata.preferredOpacity);- else- allLayers[i].setOpacity(this.DEFAULT_OVERLAY_OPACITY);- if(activeProductNames.length > 2){- this.map.setLayerZIndex(allLayers[i],nLayers-j);- }-- }- }-- }-- // Disable the layer if it wasn't found- if (!isLayerFound)- {- allLayers[i].setVisibility(false);- }--- }--};---/**- * Displays the map with a base layer and pan and zoom controls (if hasControls is true)- * All callbacks should be set. The component UI should be rendered- * with controllers to call the events.- *- *- * @this {map}- *-*/-SOTE.widget.Map.prototype.init = function(){- this.container.innerHTML = "";- // Get rid of address bar on iphone/ipod- var fixSize = function() {- window.scrollTo(0,0);- document.body.style.height = '100%';- if (!(/(iphone|ipod)/.test(navigator.userAgent.toLowerCase()))) {- if (document.body.parentNode) {- document.body.parentNode.style.height = '100%';- }- }- };- setTimeout(fixSize, 700);- setTimeout(fixSize, 1500);-- this.map = document.createElement("div");- this.map.setAttribute("id",this.id+"map");- this.container.appendChild(this.map);-- if(this.projection == "EPSG:4326"){- // Init map- this.map = new OpenLayers.Map({- div: this.containerId,- theme: null,- controls: [],- maxExtent: new OpenLayers.Bounds(-180,-1350,180,90),- projection:this.projection,- numZoomLevels:9,- fractionalZoom: false,- //maxResolution:0.5625,- resolutions: this.RESOLUTIONS_ON_SCREEN_GEO_ALL,- allOverlays: true,- zoom: 2- });-- }- else {- this.map = new OpenLayers.Map({- div: this.containerId,- theme: null,- controls: [],- maxExtent: new OpenLayers.Bounds(-4194304,-4194304,4194304,4194304),- projection:this.projection,- //maxResolution:8192.0,- resolutions: this.RESOLUTIONS_ON_SCREEN_POLAR_ALL,- allOverlays: true,- zoom: 2,- units: "m",- numZoomLevels: 6,- });-- }----- // Add user controls, if necessary- if (this.hasControls)- {- // Create zoom in/out controls- var zoomInControl = new OpenLayers.Control.ZoomIn();- zoomInControl.title = 'zoom in';- zoomInControl.displayClass = 'olControlZoomInCustom';- zoomInControl.id = 'zoomInCustomId';-- var zoomOutControl = new OpenLayers.Control.ZoomOut();- zoomOutControl.title = 'zoom out';- zoomOutControl.displayClass = 'olControlZoomOutCustom';- zoomOutControl.id = 'zoomOutCustomId';-- // Create panel to hold zoom controls and add to map- var zoomPanel = new OpenLayers.Control.Panel();- zoomPanel.displayClass = 'olControlZoomPanelCustom';- zoomPanel.addControls(zoomInControl);- zoomPanel.addControls(zoomOutControl);- this.map.addControl(zoomPanel);-- // Add navigation controls- //this.map.addControl(new OpenLayers.Control.KeyboardDefaults());- this.map.addControl(new OpenLayers.Control.Navigation({- dragPanOptions: {- enableKinetic: true- }- }));- //this.map.addControl(new OpenLayers.Control.LayerSwitcher({displayClass: 'olControlLayerSwitcher', 'ascending':false}));- //this.map.addControl(new OpenLayers.Control.OverviewMap());-- // While these aren't controls, per se, they are extra decorations- this.map.addControl(new OpenLayers.Control.Attribution());- this.map.addControl(new OpenLayers.Control.ScaleLine({displayClass: 'olControlScaleLineCustom'}));--- // Add running lat-lon- if (this.projection == "EPSG:4326")- {- this.map.addControl(new OpenLayers.Control.MousePosition(- {- //displayProjection: this.projection,- formatOutput: function(mouseLonLat) {- return mouseLonLat.lon.toFixed(3) + "°, " + mouseLonLat.lat.toFixed(3) + "°";- }- }));- }- else if (this.projection == "EPSG:3031")- {- this.map.addControl(new OpenLayers.Control.MousePosition(- {- formatOutput: function(mouseLonLat) {- return "EPSG:3031 coords: " + Math.round(mouseLonLat.lon) + "m, " + Math.round(mouseLonLat.lat) + "m";- }- }));- }- else if (this.projection == "EPSG:3995")- {- this.map.addControl(new OpenLayers.Control.MousePosition(- {- formatOutput: function(mouseLonLat) {- return "EPSG:3995 coords: " + Math.round(mouseLonLat.lon) + "m, " + Math.round(mouseLonLat.lat) + "m";- }- }));- }-- // TODO: define polar projections and convert to degrees; OL doesn't know how to handle them- // else if ((this.projection == "EPSG:3995") || (this.projection == "EPSG:3031"))- // {- // this.map.addControl(new OpenLayers.Control.MousePosition(- // {- // // numDigits: 2,- // //displayProjection: "EPSG:4326",- // formatOutput: function(mouseLonLat) {- // // Convert to lat/lon from meters- // // var projArctic = new OpenLayers.Projection("EPSG:3995");- // // var projGeo = new OpenLayers.Projection("EPSG:4326");-//- // // var point = new OpenLayers.LonLat(mouseLonLat.lon, mouseLonLat.lat);- // // point.transform(projArctic, projGeo);- // // return " " + point.lon.toFixed(3) + "°, " + point.lat.toFixed(3) + "° ";-//- // return " " + Math.round(mouseLonLat.lon) + "m, " + Math.round(mouseLonLat.lat) + "m ";- // }- // }));- // }-- // Add graticule- this.addGraticuleLayer();-- // Set mousewheel sensitivity- var navControl = this.map.getControlsByClass("OpenLayers.Control.Navigation")[0];- navControl.handlers.wheel.interval = 100;- navControl.handlers.wheel.cumulative = false;-- // this.map.addControl(new OpenLayers.Control.PanZoomBar());- }-- // Enables a zoom box by shift-clicking;- // TODO: note that it is apparently already enabled when the "Navigation" control is added- if (this.isSelectable)- {- this.map.addControl(new OpenLayers.Control.ZoomBox());- }--- // Restrict valid extent to ~(-180, -90, 180, 90) since Tiled WMS uses (-180, -1350, 180, 90)- if (this.projection == "EPSG:4326")- {- var restrictedExtent = new OpenLayers.Bounds.fromString("-230, -120, 230, 120", false).transform(- new OpenLayers.Projection(this.projection),- this.map.getProjectionObject());-- this.map.restrictedExtent = restrictedExtent;- }- else- {- this.map.restrictedExtent = new OpenLayers.Bounds.fromString("-6500000,-5000000,6500000,5000000");- }--- // Formerly / also in constructor- // Set active layer if params set- if ((this.time != null) && (this.baseLayer != null) && (this.map.layers.length > 0))- {- this.activateRelevantLayersDisableTheRest([this.baseLayer],this.time);- }-- // Set extent- if (this.isSoteMapDataCached)- {- if (this.projection == "EPSG:4326")- {- this.setExtent("-146.390625,-93.921875,146.390625,93.953125",true);- this.fire();- }- else- {- this.setExtent("-4194304,-4194304,4194304,4194304",true);- this.fire();- }-- }-- // Set up callback for when pan/zoom ends to auto-call the "fire" function- this.map.events.register("moveend", this, this.handleMapMoveEnd);--};---/**- * Checks if the given parameter is defined, not null, and not empty.- *- * @param the parameter in question- * @returns true if the parameter is defined, not null, and not empty; returns false otherwise- */-SOTE.widget.Map.prototype.checkWmsParam = function(param)-{- if ((param === undefined) ||- (param == null) ||- (param == ""))- return false;-- // else- return true;--};--/**- * Adds the given layer(s) to this.map.- *- * @param an array where each entry contains a set of parameters needed for a WMS or Tiled WMS layer;- * for each WMS layer: {displayName: "", wmsProductName: "", urls:[], layers:"", transparent:boolean, projection:"", preferredOpacity:float}- * for each Tiled WMS layer: {displayName: "", wmsProductName: "", time:"", format: "", urls:[], tileSize:[], projection:"", numZoomLevels:int, maxExtent:[], maxResolution:float, preferredOpacity:float }- *- *- * See SOTE.widget.MapSote.prototype.updateComponent for concrete examples- * and SOTE.util.generateProductLayersForDateRange for more detail on each parameter- *- */-SOTE.widget.Map.prototype.addLayers = function(layers)-{- for (var i=0; i<layers.length; i++)- {- // Fill optional parameters, as necessary- if (!this.checkWmsParam(layers[i].displayName))- layers[i].displayName = "unnamed";-- if (!this.checkWmsParam(layers[i].time))- layers[i].time = "";-- if (!this.checkWmsParam(layers[i].format))- layers[i].format = "image/jpeg"; // default to jpeg-- if (!this.checkWmsParam(layers[i].transparent))- layers[i].transparent = true;-- if (!this.checkWmsParam(layers[i].projection))- layers[i].projection = this.projection;-- if (!this.checkWmsParam(layers[i].numZoomLevels))- layers[i].numZoomLevels = (this.projection == "EPSG:4326")? 9:6;-- if (!this.checkWmsParam(layers[i].maxExtent))- layers[i].maxExtent = (this.projection == "EPSG:4326")? [-180, -1350, 180, 90]:[-4194304,-4194304,4194304,4194304];-- if (!this.checkWmsParam(layers[i].maxResolution))- layers[i].maxResolution = (this.projection == "EPSG:4326")? 0.5625: 8192.0;-- if (!this.checkWmsParam(layers[i].preferredOpacity))- layers[i].preferredOpacity = this.DEFAULT_OVERLAY_OPACITY;-- if (!this.checkWmsParam(layers[i].bringToFront))- layers[i].bringToFront = false;-- if (!this.checkWmsParam(layers[i].transitionEffect))- layers[i].transitionEffect = "resize";-- if (!this.checkWmsParam(layers[i].resolutions))- {- if (layers[i].projection == "EPSG:4326")- layers[i].resolutions = this.RESOLUTIONS_ON_SCREEN_GEO_ALL;- else- layers[i].resolutions = this.RESOLUTIONS_ON_SCREEN_POLAR_ALL;- }-- if (!this.checkWmsParam(layers[i].serverResolutions))- {- if (layers[i].projection == "EPSG:4326")- layers[i].serverResolutions = this.RESOLUTIONS_ON_SERVER_GEO_250m;- else- layers[i].serverResolutions = this.RESOLUTIONS_ON_SERVER_POLAR_250m;- }-- if (!this.checkWmsParam(layers[i].tileMatrixSet))- {- if (layers[i].projection == "EPSG:4326")- layers[i].tileMatrixSet = this.TILEMATRIXSET_GEO_250m;- else if (layers[i].projection == "EPSG:3995")- layers[i].tileMatrixSet = this.TILEMATRIXSET_ARCTIC_250m;- else- layers[i].tileMatrixSet = this.TILEMATRIXSET_ANTARCTIC_250m;- }-- // Check required params- if (!this.checkWmsParam(layers[i].urls))- {- alert("invalid / no URL passed in for layer "+layers[i].displayName);- continue;- }-- if (!this.checkWmsParam(layers[i].wmsProductName))- {- alert("invalid / unspecified WMS 'layer' parameter");- continue;- }---- // Handle tiled layers differently than standard WMS layers; include "transparent:true" in first section- if (!this.checkWmsParam(layers[i].tileSize))- {- // If 'tileSize' isn't set, consider this layer a "standard" WMS layer zzz- // Note: other params like maxExtent, numZoomLevels, maxResolution are ignored for standard WMS layers- var wmsLayer = new OpenLayers.Layer.WMS(- layers[i].displayName,- layers[i].urls,- {- layers: layers[i].wmsProductName,- format: layers[i].format,- transparent: layers[i].transparent,- },- {- isBaseLayer: false,- visibility: false,- transitioneffect: layers[i].transitionEffect,- projection: layers[i].projection,- 'tileSize': new OpenLayers.Size(512, 512),- metadata: {- preferredOpacity: layers[i].preferredOpacity,- bringToFront: layers[i].bringToFront- }- });--- // Add "time" parameter only if it's set so that servers serving static layers aren't confused- // by an empty value for time- if (this.checkWmsParam(layers[i].time))- wmsLayer.mergeNewParams({time:layers[i].time});--- this.map.addLayer(wmsLayer);- }- else- {- // If 'tileSize' is set, this should be a tiled layer- // Note: "transparent" flag is not being used for tiled layers since image format is already being specified- if ((this.projection != "EPSG:4326")){ // && (this.projection != "EPSG:3031")) {- this.map.addLayer(- new OpenLayers.Layer.WMS(- layers[i].displayName,- layers[i].urls,- {- time: layers[i].time,- layers: layers[i].wmsProductName,- Format: layers[i].format- },- {- 'tileSize': new OpenLayers.Size(layers[i].tileSize[0], layers[i].tileSize[1]),- buffer: 0,- transitionEffect: layers[i].transitionEffect,- projection: layers[i].projection,- numZoomLevels: layers[i].numZoomLevels,- maxExtent: new OpenLayers.Bounds(layers[i].maxExtent[0], layers[i].maxExtent[1], layers[i].maxExtent[2], layers[i].maxExtent[3]),- maxResolution: layers[i].maxResolution,- resolutions: layers[i].resolutions,- serverResolutions: layers[i].serverResolutions,- visibility: false,- metadata: {- preferredOpacity: layers[i].preferredOpacity,- bringToFront: layers[i].bringToFront- }- }- ));- }- else{-- var wmtsLayer =- new OpenLayers.Layer.WMTS(- {- name: layers[i].displayName,- url: layers[i].urls,- layer: layers[i].wmsProductName,- matrixSet: layers[i].tileMatrixSet, //layers[i].projection,- //matrixIds: matrixIds,- format: layers[i].format,- buffer: 0,- //time: layers[i].timeStr,- style: "",- opacity: layers[i].preferredOpacity,- transitionEffect: layers[i].transitionEffect,- projection: layers[i].projection,- numZoomLevels: layers[i].numZoomLevels, // unclear if this is necessary- maxResolution: layers[i].maxResolution, // unclear if this is necessary- resolutions: layers[i].resolutions, // unclear if this is necessary- serverResolutions: layers[i].serverResolutions,- visibility: false,- metadata: {- preferredOpacity: layers[i].preferredOpacity,- bringToFront: layers[i].bringToFront- },- 'tileSize': new OpenLayers.Size(layers[i].tileSize[0], layers[i].tileSize[1]),- maxExtent: new OpenLayers.Bounds(layers[i].maxExtent[0], layers[i].maxExtent[1], layers[i].maxExtent[2], layers[i].maxExtent[3]),- isBaseLayer: false- }-- );--- // Time parameter is not being included in request to server in the current version of OL (2.12RC7);- // need to use this hack to force inclusion of the time parameter.- wmtsLayer.mergeNewParams({time:layers[i].time});-- this.map.addLayer(wmtsLayer);- }-- }- }-- // Force graticule layer to be on top of all other layers- if (this.graticule != null)- this.map.setLayerZIndex(this.graticule.gratLayer, this.getAllLayers().length-1);-}----SOTE.widget.Map.prototype.addGraticuleLayer = function()-{- var graticuleLineStyle = new OpenLayers.Symbolizer.Line(- {- strokeColor: '#AAAAAA',- strokeOpacity: 0.95,- strokeWidth: 1.35,- strokeLinecap: 'square',- strokeDashstyle: 'dot'- }- );- var graticuleLabelStyle = new OpenLayers.Symbolizer.Text(- {- fontFamily: 'Gill Sans',- fontSize: '16',- fontWeight: '550',- fontColor: '#0000e1',- fontOpacity: 1.0- }- );- this.graticule = new OpenLayers.Control.Graticule({- layerName: 'ol_graticule',- numPoints: 2,- labelled: true,- lineSymbolizer: graticuleLineStyle,- labelSymbolizer: graticuleLabelStyle- });-- this.map.addControl(this.graticule);-};--/**- * Sets the visible extent in the map from the passed in value, if valid. formatted as [containerId]=w,s,e,n- *- * @this {map}- * @param {String} value is [containerId]=w,s,e,n- * @returns {boolean} true or false depending on if the new extent validates- *-*/-SOTE.widget.Map.prototype.setValue = function(value){-- return this.setExtent(value);-};---/**- * Gets the currently visible extent [containerId]=w,s,e,n- *- * @this {map}- * @returns {String} [containerId]=w,s,e,n represents the current visible extent of the map- *-*/-SOTE.widget.Map.prototype.getValue = function(){--/* // Retrieve current extent- var extent = this.map.getExtent();-- // Check for invalid response, return 0s if necessary- if (extent == null)- return "0, 0, 0, 0";-- // Otherwise object is valid, convert to lat/lon and return as string- return extent.transform(- this.map.getProjectionObject(),- new OpenLayers.Projection(this.projection)).toString();*/- return this.id + "=" + this.value;-};---/**- * Returns raw list of this.map's current layers- */-SOTE.widget.Map.prototype.getAllLayers = function()-{- return this.map.layers;-}---/**- * Sets the selected option(s) from the query string [containerId]=w,s,e,n- *- * @this {map}- * @param {String} qs contains the querystring ([containerId]=w,s,e,n)- * @returns {boolean} true or false depending on whether the new extent validates- *-*/-SOTE.widget.Map.prototype.loadFromQuery = function(qs){- return this.setValue(SOTE.util.extractFromQuery(this.id,qs));-};---/**- * Validates that the w,s,e,n coordinates are not null, both lat coordinates (n,s) are between -90,90, and both- * lon coordinates (w,e) are between -180,180- *- * @this {map}- * @returns {boolean} true or false depending on whether the selected option(s) meet the validation criteria-*/-SOTE.widget.Map.prototype.validate = function(){-- // Retrieve current extent- var extent = this.map.getExtent();-- // Check for invalid response, return false if necessary- if (extent == null)- {- this.setStatus("Could not retrieve current extent");- return false;- }-- // Otherwise object is valid, convert to lat/lon- var latLonExtent =- extent.transform(- this.map.getProjectionObject(),- new OpenLayers.Projection(this.projection)).toString();-- // Validate bounds- if ((latLonExtent.left < -180) ||- (latLonExtent.right > 180) ||- (latLonExtent.top > 90) ||- (latLonExtent.bottom < -90))- {- this.setStatus("Current extent is out of bounds");- return false;- }--- // else- return true;-};--/**- * Sets the data accessor that provides state change instructions given dependencies- *- * @this {map}- * @param {String} datasourceurl is the relative location of the data accessor- *-*/-SOTE.widget.Map.prototype.setDataSourceUrl = function(datasourceurl){- // TODO: Content-};--/**- * Gets the data accessor- *- * @this {map}- * @returns {String} the relative location of the accessor- *-*/-SOTE.widget.Map.prototype.getDataSourceUrl = function(){- // TODO: Content-};--/**- * Sets the status of the component- *- * @this {map}- * @param {String} s the current status of the component (user prompts, error messages)- *-*/-SOTE.widget.Map.prototype.setStatus = function(s){-- this.statusStr = s;-};--/**- * Gets the status of the component- *- * @this {map}- * @returns {String} the current status of the component (user prompts, error messages)- *-*/-SOTE.widget.Map.prototype.getStatus = function(){-- return this.statusStr;-};---/**- * Sets the visible extent of the map- *- * @this {map}- * @param {String} extent is formatted as [containerId]=w,s,e,n- * @returns {boolean} true or false depending on if the component validates with the new extent- *-*/-SOTE.widget.Map.prototype.setExtent = function(extent,force){-- // Parse bounding box string and apply to map- // Need to convert from lat/lon to map's native coord system- var OLExtent = new OpenLayers.Bounds.fromString(extent, false).transform(- new OpenLayers.Projection(this.projection),- this.map.getProjectionObject());-- if (OLExtent == null)- {- this.setStatus("Could not set extent");- return false;- }-- // else- // prevent unnecessary updates- if (extent == this.value && !force)- {- return;- }-- // Update member variable- this.value = extent;-- // Zoom to specified extent, finally- this.map.zoomToExtent(OLExtent, true);- return true;-};---/**- * Fires an event in the registry when the component value is changed- *- * @author T. Joshi- */-SOTE.widget.Map.prototype.fire = function(){-- if(REGISTRY){- REGISTRY.fire(this);- }- else{- alert("No REGISTRY found! Cannot fire to REGISTRY from Map!");- }--};---/**- * Change the base layers based on dependencies (i.e. extent, date, data product)- *- * @this {map}- * @param {String} querystring contains all values of dependencies (from registry)- * @returns {boolean} true or false depending on if the component still validates with the new criteria- *-*/-SOTE.widget.Map.prototype.updateComponent = function(querystring){---};\ No newline at end of filediff --git a/js/mapSote.js b/js/mapSote.jsdeleted file mode 100644index ccb497467..000000000--- a/js/mapSote.js+++ /dev/null@@ -1,651 +0,0 @@-SOTE.namespace("SOTE.widget.MapSote");---/**- * Instantiate the map; subclass of SOTE.widget.Map that is SOTE-specific- *- *- * @class Instantiates a map projection layered with images retrieved from the specified client- * derived from the given bounding box, date, and data product- * @constructor- * @this {map}- * @param {String} containerId is the container id of the div in which to render the object- * @param {Object} [config] is a hash allowing configuration of this component- * @config {boolean} [hasControls] whether or not the produced map should have zoom and pan controls- * @config {boolean} [isSelectable] whether or not a bounding box selection is allowed- * @config {String} [bbox] the extent of the map as w,s,e,n- * @augments SOTE.widget.Component- *-*/--SOTE.widget.MapSote = function(containerId, config)-{- // ie, super(containerId, config);- SOTE.widget.Map.call(this,containerId, config);-- // Load SOTE-specific data into MapSote- //this.isSoteMapDataCached = false;- //this.updateComponent("");-- // Init- this.isLayerCachingEnabled = false;- this.terribleQsSaver = "";- this.terribleQsSaverJustSet = false;- this.terribleProductListSaver = "";- this.state = "geographic";-- this.setExtent(this.bbox);-- // Register MapSote-specific callbacks etc- this.initMapSote();-};---SOTE.widget.MapSote.prototype = new SOTE.widget.Map;---SOTE.widget.MapSote.prototype.initMapSote = function()-{- this.isLayerCachingEnabled = false;- this.terribleQsSaver = "";- this.terribleQsSaverJustSet = false;- this.terribleProductListSaver = "";--- // Register callbacks for when movement begins and zoom ends- this.map.events.register("movestart", this, this.handleMapMoveStart);- this.map.events.register("zoomend", this, this.handleMapZoomEnd);-- // Force "zoom end" for widget init- this.handleMapZoomEnd(null);--- // Recenter map- if (this.projection == "EPSG:4326")- {- // Set default extent according to time of day:- // at 00:00 UTC, start at far eastern edge of map: "20.6015625,-46.546875,179.9296875,53.015625"- // at 23:00 UTC, start at far western edge of map: "-179.9296875,-46.546875,-20.6015625,53.015625"- var curHour = new Date().getUTCHours();-- // For earlier hours when data is still being filled in, force a far eastern perspective- if (curHour < 9)- curHour = 0;-- // Compute east/west bounds- var minLon = 20.6015625 + curHour * (-200.53125/23.0);- var maxLon = minLon + 159.328125;-- var bbox = minLon.toString() + ",-46.546875,"+maxLon.toString()+",53.015625";-- //this.setExtent("-146.390625,-93.921875,146.390625,93.953125",true);- this.setExtent(bbox,true);- this.fire();- }- else- {- this.setExtent("-4194304,-4194304,4194304,4194304",true);- this.fire();- }-}---/**- * Sets whether the existing time steps (ie layers) are allowed to remain enabled/active even if that- * particular time step isn't selected - the layer's opacity is simply reduced to 0; this- * is necessary to enable instantaneous switching between time steps instead of needing to- * reload the data on every time change. It becomes a burden when panning/zooming, though, so- * this function should be used carefully.- *- * @param {boolean} true to enable caching- */-SOTE.widget.MapSote.prototype.setLayerCaching = function(enable)-{- this.isLayerCachingEnabled = enable;-}---/**- * OpenLayers callback that's called as soon as user begins moving the map; currently used to- * disable layer caching- */-SOTE.widget.MapSote.prototype.handleMapMoveStart = function(evt)-{- // Disable map caching after pan/zoom- this.setLayerCaching(false);-- // TODO: Set only active time step(s) to be enabled- // Currently: this terrible hack- if (this.terribleQsSaver != "")- {- this.terribleQsSaverJustSet = true;- this.updateComponent(this.terribleQsSaver);- }--}--/**- * OpenLayers callback that's called whenever a zoom action ends; currently used to- * update zoom button opacity if at limits of zoom levels- */-SOTE.widget.MapSote.prototype.handleMapZoomEnd = function(evt)-{- // "Disable" zoom in icon if zoomed to highest level- // TODO: fix "color" updates since they don't currently have an effect- if (this.map.zoom == this.map.numZoomLevels-1)- {- $('.olControlZoomInCustomItemInactive').css("background-color", "rgba(38,38,38,0.3)");- $('.olControlZoomInCustomItemInactive').css("color", "#555555");- }- else- {- $('.olControlZoomInCustomItemInactive').css("background-color", "rgba(45,50,55,0.70)");- $('.olControlZoomInCustomItemInactive').css("color", "#FFFFFF");- }-- // "Disable" zoom out icon if zoomed to lowest level- if (this.map.zoom == 0)- {- $('.olControlZoomOutCustomItemInactive').css("background-color", "rgba(38,38,38,0.3)");- $('.olControlZoomOutCustomItemInactive').css("color", "#555555");- }- else- {- $('.olControlZoomOutCustomItemInactive').css("background-color", "rgba(45,50,55,0.70)");- $('.olControlZoomOutCustomItemInactive').css("color", "#FFFFFF");- }--}--/**- * Adds product to map object by creating a separate layer for that product for each accessible date- *- * @param product the product name- * @param state the current projection state- */-SOTE.widget.MapSote.prototype.addProductToMap = function(product, state)-{- var layersToAdd = [];-- if(this.state == "geographic")- {- layersToAdd = [- SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Terra_CorrectedReflectance_TrueColor", "MODIS_Terra_CorrectedReflectance_TrueColor", "image/jpeg", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_250m, this.TILEMATRIXSET_GEO_250m),- SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Terra_SurfaceReflectance_Bands143", "MODIS_Terra_SurfaceReflectance_Bands143", "image/jpeg", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_500m, this.TILEMATRIXSET_GEO_500m),- SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Aqua_CorrectedReflectance_TrueColor", "MODIS_Aqua_CorrectedReflectance_TrueColor", "image/jpeg", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_250m, this.TILEMATRIXSET_GEO_250m),- SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Aqua_SurfaceReflectance_Bands143", "MODIS_Aqua_SurfaceReflectance_Bands143", "image/jpeg", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_500m, this.TILEMATRIXSET_GEO_500m),- SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Terra_CorrectedReflectance_Bands721", "MODIS_Terra_CorrectedReflectance_Bands721", "image/jpeg", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_250m, this.TILEMATRIXSET_GEO_250m),- SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Aqua_CorrectedReflectance_Bands721", "MODIS_Aqua_CorrectedReflectance_Bands721", "image/jpeg", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_250m, this.TILEMATRIXSET_GEO_250m),- SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Terra_SurfaceReflectance_Bands721", "MODIS_Terra_SurfaceReflectance_Bands721", "image/jpeg", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_500m, this.TILEMATRIXSET_GEO_500m),- SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Aqua_SurfaceReflectance_Bands721", "MODIS_Aqua_SurfaceReflectance_Bands721", "image/jpeg", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_500m, this.TILEMATRIXSET_GEO_500m),- SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Terra_CorrectedReflectance_Bands367", "MODIS_Terra_CorrectedReflectance_Bands367", "image/jpeg", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_250m, this.TILEMATRIXSET_GEO_250m),- SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Terra_SurfaceReflectance_Bands121", "MODIS_Terra_SurfaceReflectance_Bands121", "image/jpeg", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_500m, this.TILEMATRIXSET_GEO_250m),- SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Aqua_SurfaceReflectance_Bands121", "MODIS_Aqua_SurfaceReflectance_Bands121", "image/jpeg", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_500m, this.TILEMATRIXSET_GEO_250m),-- SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Terra_Data_No_Data", "MODIS_Terra_Data_No_Data", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_250m, this.TILEMATRIXSET_GEO_250m),- SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Aqua_Data_No_Data", "MODIS_Aqua_Data_No_Data", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_250m, this.TILEMATRIXSET_GEO_250m),-- SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Terra_Snow_Cover", "MODIS_Terra_Snow_Cover", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_500m, this.TILEMATRIXSET_GEO_500m),- SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Aqua_Snow_Cover", "MODIS_Aqua_Snow_Cover", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_500m, this.TILEMATRIXSET_GEO_500m),- SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Terra_Sea_Ice", "MODIS_Terra_Sea_Ice", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_1km, this.TILEMATRIXSET_GEO_1km),- SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Aqua_Sea_Ice", "MODIS_Aqua_Sea_Ice", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_1km, this.TILEMATRIXSET_GEO_1km),- SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Terra_Land_Surface_Temp_Day", "MODIS_Terra_Land_Surface_Temp_Day", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_1km, this.TILEMATRIXSET_GEO_1km),- SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Aqua_Land_Surface_Temp_Day", "MODIS_Aqua_Land_Surface_Temp_Day", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_1km, this.TILEMATRIXSET_GEO_1km),- SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Terra_Land_Surface_Temp_Night", "MODIS_Terra_Land_Surface_Temp_Night", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_1km, this.TILEMATRIXSET_GEO_1km),- SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Aqua_Land_Surface_Temp_Night", "MODIS_Aqua_Land_Surface_Temp_Night", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_1km, this.TILEMATRIXSET_GEO_1km),- SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Terra_Brightness_Temp_Band31_Day", "MODIS_Terra_Brightness_Temp_Band31_Day", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_1km, this.TILEMATRIXSET_GEO_1km),- SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Aqua_Brightness_Temp_Band31_Day", "MODIS_Aqua_Brightness_Temp_Band31_Day", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_1km, this.TILEMATRIXSET_GEO_1km),- SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Terra_Brightness_Temp_Band31_Night", "MODIS_Terra_Brightness_Temp_Band31_Night", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_1km, this.TILEMATRIXSET_GEO_1km),- SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Aqua_Brightness_Temp_Band31_Night", "MODIS_Aqua_Brightness_Temp_Band31_Night", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_1km, this.TILEMATRIXSET_GEO_1km),- SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Terra_Aerosol", "MODIS_Terra_Aerosol", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_2km, this.TILEMATRIXSET_GEO_2km),- SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Aqua_Aerosol", "MODIS_Aqua_Aerosol", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_2km, this.TILEMATRIXSET_GEO_2km),- SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Combined_Value_Added_AOD", "MODIS_Combined_Value_Added_AOD", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_2km, this.TILEMATRIXSET_GEO_2km),- SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Terra_Water_Vapor_5km_Day", "MODIS_Terra_Water_Vapor_5km_Day", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_2km, this.TILEMATRIXSET_GEO_2km),- SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Aqua_Water_Vapor_5km_Day", "MODIS_Aqua_Water_Vapor_5km_Day", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_2km, this.TILEMATRIXSET_GEO_2km),- SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Terra_Water_Vapor_5km_Night", "MODIS_Terra_Water_Vapor_5km_Night", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_2km, this.TILEMATRIXSET_GEO_2km),- SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Aqua_Water_Vapor_5km_Night", "MODIS_Aqua_Water_Vapor_5km_Night", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_2km, this.TILEMATRIXSET_GEO_2km),- SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Terra_Cloud_Top_Pressure_Day", "MODIS_Terra_Cloud_Top_Pressure_Day", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_2km, this.TILEMATRIXSET_GEO_2km),- SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Aqua_Cloud_Top_Pressure_Day", "MODIS_Aqua_Cloud_Top_Pressure_Day", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_2km, this.TILEMATRIXSET_GEO_2km),- SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Terra_Cloud_Top_Pressure_Night", "MODIS_Terra_Cloud_Top_Pressure_Night", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_2km, this.TILEMATRIXSET_GEO_2km),- SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Aqua_Cloud_Top_Pressure_Night", "MODIS_Aqua_Cloud_Top_Pressure_Night", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_2km, this.TILEMATRIXSET_GEO_2km),- SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Terra_Cloud_Top_Temp_Day", "MODIS_Terra_Cloud_Top_Temp_Day", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_2km, this.TILEMATRIXSET_GEO_2km),- SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Aqua_Cloud_Top_Temp_Day", "MODIS_Aqua_Cloud_Top_Temp_Day", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_2km, this.TILEMATRIXSET_GEO_2km),- SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Terra_Cloud_Top_Temp_Night", "MODIS_Terra_Cloud_Top_Temp_Night", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_2km, this.TILEMATRIXSET_GEO_2km),- SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Aqua_Cloud_Top_Temp_Night", "MODIS_Aqua_Cloud_Top_Temp_Night", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_2km, this.TILEMATRIXSET_GEO_2km),-- SOTE.util.generateProductLayersForDateRangeTMS(product, "AIRS_Dust_Score", "AIRS_Dust_Score", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_2km, this.TILEMATRIXSET_GEO_2km),- SOTE.util.generateProductLayersForDateRangeTMS(product, "AIRS_CO_Total_Column_Day", "AIRS_CO_Total_Column_Day", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_2km, this.TILEMATRIXSET_GEO_2km),- SOTE.util.generateProductLayersForDateRangeTMS(product, "AIRS_CO_Total_Column_Night", "AIRS_CO_Total_Column_Night", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_2km, this.TILEMATRIXSET_GEO_2km),- SOTE.util.generateProductLayersForDateRangeTMS(product, "AIRS_Prata_SO2_Index_Day", "AIRS_Prata_SO2_Index_Day", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_2km, this.TILEMATRIXSET_GEO_2km),- SOTE.util.generateProductLayersForDateRangeTMS(product, "AIRS_Prata_SO2_Index_Night", "AIRS_Prata_SO2_Index_Night", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_2km, this.TILEMATRIXSET_GEO_2km),- SOTE.util.generateProductLayersForDateRangeTMS(product, "AIRS_Precipitation_Day", "AIRS_Precipitation_Day", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_2km, this.TILEMATRIXSET_GEO_2km),- SOTE.util.generateProductLayersForDateRangeTMS(product, "AIRS_Precipitation_Night", "AIRS_Precipitation_Night", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_2km, this.TILEMATRIXSET_GEO_2km),-- SOTE.util.generateProductLayersForDateRangeTMS(product, "OMI_Cloud_Pressure", "OMI_Cloud_Pressure", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_2km, this.TILEMATRIXSET_GEO_2km),- SOTE.util.generateProductLayersForDateRangeTMS(product, "OMI_Aerosol_Index", "OMI_Aerosol_Index", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_2km, this.TILEMATRIXSET_GEO_2km),- SOTE.util.generateProductLayersForDateRangeTMS(product, "OMI_Aerosol_Optical_Depth", "OMI_Aerosol_Optical_Depth", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_2km, this.TILEMATRIXSET_GEO_2km),- SOTE.util.generateProductLayersForDateRangeTMS(product, "OMI_Absorbing_Aerosol_Optical_Depth", "OMI_Absorbing_Aerosol_Optical_Depth", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_2km, this.TILEMATRIXSET_GEO_2km),- SOTE.util.generateProductLayersForDateRangeTMS(product, "OMI_SO2_Lower_Troposphere", "OMI_SO2_Lower_Troposphere", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_2km, this.TILEMATRIXSET_GEO_2km),- SOTE.util.generateProductLayersForDateRangeTMS(product, "OMI_SO2_Middle_Troposphere", "OMI_SO2_Middle_Troposphere", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_2km, this.TILEMATRIXSET_GEO_2km),- SOTE.util.generateProductLayersForDateRangeTMS(product, "OMI_SO2_Upper_Troposphere_and_Stratosphere", "OMI_SO2_Upper_Troposphere_and_Stratosphere", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_2km, this.TILEMATRIXSET_GEO_2km),- SOTE.util.generateProductLayersForDateRangeTMS(product, "OMI_SO2_Planetary_Boundary_Layer", "OMI_SO2_Planetary_Boundary_Layer", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_2km, this.TILEMATRIXSET_GEO_2km),-- SOTE.util.generateProductLayersForDateRangeTMS(product, "OBPG_MODIS_Aqua_Chlorophyll_A", "OBPG_MODIS_Aqua_Chlorophyll_A", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_1km, this.TILEMATRIXSET_GEO_1km),- SOTE.util.generateProductLayersForDateRangeTMS(product, "OBPG_SeaSurfaceTemperature_11_Day", "OBPG_SeaSurfaceTemperature_11_Day", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], [512,512], "EPSG:4326", 9, [-180,-1350,180,90], 0.5625, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_GEO_ALL, this.RESOLUTIONS_ON_SERVER_GEO_1km, this.TILEMATRIXSET_GEO_1km),-- SOTE.util.generateWmsProductLayersForDateRange(product, "MODIS_Fires_All", "MODIS_Fires_All", "image/png", ["http://map2a.vis.earthdata.nasa.gov/wms/wms.php", "http://map2b.vis.earthdata.nasa.gov/wms/wms.php", "http://map2c.vis.earthdata.nasa.gov/wms/wms.php"], "EPSG:4326", 1.0, true, this.NUM_DAYS_TO_GENERATE),- SOTE.util.generateWmsProductLayersForDateRange(product, "MODIS_Fires_Terra", "MODIS_Fires_Terra", "image/png", ["http://map2a.vis.earthdata.nasa.gov/wms/wms.php", "http://map2b.vis.earthdata.nasa.gov/wms/wms.php", "http://map2c.vis.earthdata.nasa.gov/wms/wms.php"], "EPSG:4326", 1.0, true, this.NUM_DAYS_TO_GENERATE),- SOTE.util.generateWmsProductLayersForDateRange(product, "MODIS_Fires_Aqua", "MODIS_Fires_Aqua", "image/png", ["http://map2a.vis.earthdata.nasa.gov/wms/wms.php", "http://map2b.vis.earthdata.nasa.gov/wms/wms.php", "http://map2c.vis.earthdata.nasa.gov/wms/wms.php"], "EPSG:4326", 1.0, true, this.NUM_DAYS_TO_GENERATE),- SOTE.util.generateWmsProductLayersForDateRange(product, "Terra_Orbit_Asc", "Terra_Orbit_Asc", "image/png", ["http://map2a.vis.earthdata.nasa.gov/wms/wms.php", "http://map2b.vis.earthdata.nasa.gov/wms/wms.php", "http://map2c.vis.earthdata.nasa.gov/wms/wms.php"], "EPSG:4326", 1.0, true, this.NUM_DAYS_TO_GENERATE),- SOTE.util.generateWmsProductLayersForDateRange(product, "Terra_Orbit_Dsc", "Terra_Orbit_Dsc", "image/png", ["http://map2a.vis.earthdata.nasa.gov/wms/wms.php", "http://map2b.vis.earthdata.nasa.gov/wms/wms.php", "http://map2c.vis.earthdata.nasa.gov/wms/wms.php"], "EPSG:4326", 1.0, true, this.NUM_DAYS_TO_GENERATE),- SOTE.util.generateWmsProductLayersForDateRange(product, "Aqua_Orbit_Asc", "Aqua_Orbit_Asc", "image/png", ["http://map2a.vis.earthdata.nasa.gov/wms/wms.php", "http://map2b.vis.earthdata.nasa.gov/wms/wms.php", "http://map2c.vis.earthdata.nasa.gov/wms/wms.php"], "EPSG:4326", 1.0, true, this.NUM_DAYS_TO_GENERATE),- SOTE.util.generateWmsProductLayersForDateRange(product, "Aqua_Orbit_Dsc", "Aqua_Orbit_Dsc", "image/png", ["http://map2a.vis.earthdata.nasa.gov/wms/wms.php", "http://map2b.vis.earthdata.nasa.gov/wms/wms.php", "http://map2c.vis.earthdata.nasa.gov/wms/wms.php"], "EPSG:4326", 1.0, true, this.NUM_DAYS_TO_GENERATE),- SOTE.util.generateWmsProductLayersForDateRange(product, "Aura_Orbit_Asc", "Aura_Orbit_Asc", "image/png", ["http://map2a.vis.earthdata.nasa.gov/wms/wms.php", "http://map2b.vis.earthdata.nasa.gov/wms/wms.php", "http://map2c.vis.earthdata.nasa.gov/wms/wms.php"], "EPSG:4326", 1.0, true, this.NUM_DAYS_TO_GENERATE),- SOTE.util.generateWmsProductLayersForDateRange(product, "Aura_Orbit_Dsc", "Aura_Orbit_Dsc", "image/png", ["http://map2a.vis.earthdata.nasa.gov/wms/wms.php", "http://map2b.vis.earthdata.nasa.gov/wms/wms.php", "http://map2c.vis.earthdata.nasa.gov/wms/wms.php"], "EPSG:4326", 1.0, true, this.NUM_DAYS_TO_GENERATE),-- (product == "sedac_bound") ? [{displayName: "sedac_bound", wmsProductName: "sedac_bound", time:"", format: "image/png", urls:["http://map1a.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], tileSize:[512,512], projection:"EPSG:4326", numZoomLevels:9, maxExtent:[-180,-1350,180,90], maxResolution:0.5625, preferredOpacity: 0.90, bringToFront: true, transitionEffect:"none" }] : [],- (product == "MODIS_Land_Water_Mask") ? [{displayName: "MODIS_Land_Water_Mask", wmsProductName: "MODIS_Land_Water_Mask", time:"", format: "image/png", urls:["http://map1.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], tileSize:[512,512], projection:"EPSG:4326", numZoomLevels:9, maxExtent:[-180,-1350,180,90], maxResolution:0.5625, preferredOpacity: 0.75, bringToFront:true }] : [],- (product == "VIIRS_CityLights_2012") ? [{displayName: "VIIRS_CityLights_2012", wmsProductName: "VIIRS_CityLights_2012", time:"", format: "image/jpeg", urls:["http://map1.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi"], tileSize:[512,512], projection:"EPSG:4326", numZoomLevels:9, maxExtent:[-180,-1350,180,90], maxResolution:0.5625, resolutions: this.RESOLUTIONS_ON_SCREEN_GEO_ALL, serverResolutions: this.RESOLUTIONS_ON_SERVER_GEO_500m, tileMatrixSet: this.TILEMATRIXSET_GEO_500m, preferredOpacity: 1.0, bringToFront:true }] : [],- (product == "grump-v1-population-count_2000") ? [{displayName: "grump-v1-population-count_2000", wmsProductName: "grump-v1-population-count_2000", time:"", format: "image/png", urls:["http://sedac.ciesin.columbia.edu/geoserver/ows"], projection:"EPSG:4326", preferredOpacity: 0.55 }] : [],- (product == "ndh-cyclone-hazard-frequency-distribution") ? [{displayName: "ndh-cyclone-hazard-frequency-distribution", wmsProductName: "ndh-cyclone-hazard-frequency-distribution", time:"", format: "image/png", urls:["http://sedac.ciesin.columbia.edu/geoserver/ows"], projection:"EPSG:4326", preferredOpacity: 0.75 }] : [],- (product == "ndh-cyclone-proportional-economic-loss-risk-deciles") ? [{displayName: "ndh-cyclone-proportional-economic-loss-risk-deciles", wmsProductName: "ndh-cyclone-proportional-economic-loss-risk-deciles", time:"", format: "image/png", urls:["http://sedac.ciesin.columbia.edu/geoserver/ows"], projection:"EPSG:4326", preferredOpacity: 0.75 }] : [],- (product == "ndh-cyclone-mortality-risks-distribution") ? [{displayName: "ndh-cyclone-mortality-risks-distribution", wmsProductName: "ndh-cyclone-mortality-risks-distribution", time:"", format: "image/png", urls:["http://sedac.ciesin.columbia.edu/geoserver/ows"], projection:"EPSG:4326", preferredOpacity: 0.75 }] : [],- (product == "ndh-flood-hazard-frequency-distribution") ? [{displayName: "ndh-flood-hazard-frequency-distribution", wmsProductName: "ndh-flood-hazard-frequency-distribution", time:"", format: "image/png", urls:["http://sedac.ciesin.columbia.edu/geoserver/ows"], projection:"EPSG:4326", preferredOpacity: 0.75 }] : [],- (product == "ndh-flood-proportional-economic-loss-risk-deciles") ? [{displayName: "ndh-flood-proportional-economic-loss-risk-deciles", wmsProductName: "ndh-flood-proportional-economic-loss-risk-deciles", time:"", format: "image/png", urls:["http://sedac.ciesin.columbia.edu/geoserver/ows"], projection:"EPSG:4326", preferredOpacity: 0.75 }] : [],- (product == "ndh-flood-mortality-risks-distribution") ? [{displayName: "ndh-flood-mortality-risks-distribution", wmsProductName: "ndh-flood-mortality-risks-distribution", time:"", format: "image/png", urls:["http://sedac.ciesin.columbia.edu/geoserver/ows"], projection:"EPSG:4326", preferredOpacity: 0.75 }] : [],- (product == "ndh-drought-hazard-frequency-distribution") ? [{displayName: "ndh-drought-hazard-frequency-distribution", wmsProductName: "ndh-drought-hazard-frequency-distribution", time:"", format: "image/png", urls:["http://sedac.ciesin.columbia.edu/geoserver/ows"], projection:"EPSG:4326", preferredOpacity: 0.75 }] : [],- (product == "ndh-drought-proportional-economic-loss-risk-deciles") ? [{displayName: "ndh-drought-proportional-economic-loss-risk-deciles", wmsProductName: "ndh-drought-proportional-economic-loss-risk-deciles", time:"", format: "image/png", urls:["http://sedac.ciesin.columbia.edu/geoserver/ows"], projection:"EPSG:4326", preferredOpacity: 0.75 }] : [],- (product == "ndh-drought-mortality-risks-distribution") ? [{displayName: "ndh-drought-mortality-risks-distribution", wmsProductName: "ndh-drought-mortality-risks-distribution", time:"", format: "image/png", urls:["http://sedac.ciesin.columbia.edu/geoserver/ows"], projection:"EPSG:4326", preferredOpacity: 0.75 }] : [],- (product == "ndh-volcano-hazard-frequency-distribution") ? [{displayName: "ndh-volcano-hazard-frequency-distribution", wmsProductName: "ndh-volcano-hazard-frequency-distribution", time:"", format: "image/png", urls:["http://sedac.ciesin.columbia.edu/geoserver/ows"], projection:"EPSG:4326", preferredOpacity: 0.75 }] : [],- (product == "ndh-volcano-proportional-economic-loss-risk-deciles") ? [{displayName: "ndh-volcano-proportional-economic-loss-risk-deciles", wmsProductName: "ndh-volcano-proportional-economic-loss-risk-deciles", time:"", format: "image/png", urls:["http://sedac.ciesin.columbia.edu/geoserver/ows"], projection:"EPSG:4326", preferredOpacity: 0.75 }] : [],- (product == "ndh-volcano-mortality-risks-distribution") ? [{displayName: "ndh-volcano-mortality-risks-distribution", wmsProductName: "ndh-volcano-mortality-risks-distribution", time:"", format: "image/png", urls:["http://sedac.ciesin.columbia.edu/geoserver/ows"], projection:"EPSG:4326", preferredOpacity: 0.75 }] : [],- (product == "cartographic:esri-administrative-boundaries_level-1") ? [{displayName: "cartographic:esri-administrative-boundaries_level-1", wmsProductName: "cartographic:esri-administrative-boundaries_level-1", time:"", urls:["http://sedac.ciesin.columbia.edu/geoserver/wms?"], layers:"cartographic:esri-administrative-boundaries_level-1", transparent:true, projection:"EPSG:4326", preferredOpacity: 0.55, bringToFront: true }] : [],- (product == "gpw-v3-coastlines") ? [{displayName: "gpw-v3-coastlines", wmsProductName: "gpw-v3-coastlines", time:"", urls:["http://sedac.ciesin.columbia.edu/geoserver/wms?"], layers:"gpw-v3-coastlines", transparent:true, projection:"EPSG:4326", preferredOpacity: 0.85, bringToFront: true}] : [],- (product == "cartographic:00-global-labels") ? [{displayName: "cartographic:00-global-labels", wmsProductName: "cartographic:00-global-labels", time:"", urls:["http://sedac.ciesin.columbia.edu/geoserver/wms?"], layers:"cartographic:00-global-labels", transparent:true, projection:"EPSG:4326", preferredOpacity: 0.95, bringToFront: true }] : []- ];--- }- else if (this.state == "arctic")- {- layersToAdd = [- SOTE.util.generateProductLayersForDateRange(product, "MODIS_Terra_CorrectedReflectance_TrueColor", "MODIS_Terra_CorrectedReflectance_TrueColor", "image/jpeg", ["http://map1a.vis.earthdata.nasa.gov/arctic/wms.cgi", "http://map1b.vis.earthdata.nasa.gov/arctic/wms.cgi", "http://map1c.vis.earthdata.nasa.gov/arctic/wms.cgi"], [512,512], "EPSG:3995", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_250m),- SOTE.util.generateProductLayersForDateRange(product, "MODIS_Aqua_CorrectedReflectance_TrueColor", "MODIS_Aqua_CorrectedReflectance_TrueColor", "image/jpeg", ["http://map1a.vis.earthdata.nasa.gov/arctic/wms.cgi", "http://map1b.vis.earthdata.nasa.gov/arctic/wms.cgi", "http://map1c.vis.earthdata.nasa.gov/arctic/wms.cgi"], [512,512], "EPSG:3995", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_250m),- SOTE.util.generateProductLayersForDateRange(product, "MODIS_Terra_CorrectedReflectance_Bands367", "MODIS_Terra_CorrectedReflectance_Bands367", "image/jpeg", ["http://map1a.vis.earthdata.nasa.gov/arctic/wms.cgi", "http://map1b.vis.earthdata.nasa.gov/arctic/wms.cgi", "http://map1c.vis.earthdata.nasa.gov/arctic/wms.cgi"], [512,512], "EPSG:3995", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_250m),-- SOTE.util.generateProductLayersForDateRange(product, "MODIS_Terra_Brightness_Temp_Band31_Day", "MODIS_Terra_Brightness_Temp_Band31_Day", "image/png", ["http://map1a.vis.earthdata.nasa.gov/arctic/wms.cgi", "http://map1b.vis.earthdata.nasa.gov/arctic/wms.cgi", "http://map1c.vis.earthdata.nasa.gov/arctic/wms.cgi"], [512,512], "EPSG:3995", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_1km),- SOTE.util.generateProductLayersForDateRange(product, "MODIS_Terra_Brightness_Temp_Band31_Night", "MODIS_Terra_Brightness_Temp_Band31_Night", "image/png", ["http://map1a.vis.earthdata.nasa.gov/arctic/wms.cgi", "http://map1b.vis.earthdata.nasa.gov/arctic/wms.cgi", "http://map1c.vis.earthdata.nasa.gov/arctic/wms.cgi"], [512,512], "EPSG:3995", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_1km),- SOTE.util.generateProductLayersForDateRange(product, "MODIS_Aqua_Brightness_Temp_Band31_Day", "MODIS_Aqua_Brightness_Temp_Band31_Day", "image/png", ["http://map1a.vis.earthdata.nasa.gov/arctic/wms.cgi", "http://map1b.vis.earthdata.nasa.gov/arctic/wms.cgi", "http://map1c.vis.earthdata.nasa.gov/arctic/wms.cgi"], [512,512], "EPSG:3995", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_1km),- SOTE.util.generateProductLayersForDateRange(product, "MODIS_Aqua_Brightness_Temp_Band31_Night", "MODIS_Aqua_Brightness_Temp_Band31_Night", "image/png", ["http://map1a.vis.earthdata.nasa.gov/arctic/wms.cgi", "http://map1b.vis.earthdata.nasa.gov/arctic/wms.cgi", "http://map1c.vis.earthdata.nasa.gov/arctic/wms.cgi"], [512,512], "EPSG:3995", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_1km),- SOTE.util.generateProductLayersForDateRange(product, "MODIS_Terra_Snow_Cover", "MODIS_Terra_Snow_Cover", "image/png", ["http://map1a.vis.earthdata.nasa.gov/arctic/wms.cgi", "http://map1b.vis.earthdata.nasa.gov/arctic/wms.cgi", "http://map1c.vis.earthdata.nasa.gov/arctic/wms.cgi"], [512,512], "EPSG:3995", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_500m),- SOTE.util.generateProductLayersForDateRange(product, "MODIS_Aqua_Snow_Cover", "MODIS_Aqua_Snow_Cover", "image/png", ["http://map1a.vis.earthdata.nasa.gov/arctic/wms.cgi", "http://map1b.vis.earthdata.nasa.gov/arctic/wms.cgi", "http://map1c.vis.earthdata.nasa.gov/arctic/wms.cgi"], [512,512], "EPSG:3995", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_500m),- SOTE.util.generateProductLayersForDateRange(product, "MODIS_Terra_Sea_Ice", "MODIS_Terra_Sea_Ice", "image/png", ["http://map1a.vis.earthdata.nasa.gov/arctic/wms.cgi", "http://map1b.vis.earthdata.nasa.gov/arctic/wms.cgi", "http://map1c.vis.earthdata.nasa.gov/arctic/wms.cgi"], [512,512], "EPSG:3995", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_1km),- SOTE.util.generateProductLayersForDateRange(product, "MODIS_Aqua_Sea_Ice", "MODIS_Aqua_Sea_Ice", "image/png", ["http://map1a.vis.earthdata.nasa.gov/arctic/wms.cgi", "http://map1b.vis.earthdata.nasa.gov/arctic/wms.cgi", "http://map1c.vis.earthdata.nasa.gov/arctic/wms.cgi"], [512,512], "EPSG:3995", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_1km),-- // Commented out until polar WMTSes are ready- // SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Terra_CorrectedReflectance_TrueColor", "MODIS_Terra_CorrectedReflectance_TrueColor", "image/jpeg", ["http://map1a.vis.earthdata.nasa.gov/wmts-arctic/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-arctic/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-arctic/wmts.cgi"], [512,512], "EPSG:3995", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_250m, this.TILEMATRIXSET_ARCTIC_250m),- // SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Aqua_CorrectedReflectance_TrueColor", "MODIS_Aqua_CorrectedReflectance_TrueColor", "image/jpeg", ["http://map1a.vis.earthdata.nasa.gov/wmts-arctic/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-arctic/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-arctic/wmts.cgi"], [512,512], "EPSG:3995", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_250m, this.TILEMATRIXSET_ARCTIC_250m),- // SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Terra_CorrectedReflectance_Bands367", "MODIS_Terra_CorrectedReflectance_Bands367", "image/jpeg", ["http://map1a.vis.earthdata.nasa.gov/wmts-arctic/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-arctic/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-arctic/wmts.cgi"], [512,512], "EPSG:3995", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_250m, this.TILEMATRIXSET_ARCTIC_250m),-//- // SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Terra_Brightness_Temp_Band31_Day", "MODIS_Terra_Brightness_Temp_Band31_Day", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-arctic/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-arctic/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-arctic/wmts.cgi"], [512,512], "EPSG:3995", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_1km, this.TILEMATRIXSET_ARCTIC_1km),- // SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Terra_Brightness_Temp_Band31_Night", "MODIS_Terra_Brightness_Temp_Band31_Night", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-arctic/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-arctic/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-arctic/wmts.cgi"], [512,512], "EPSG:3995", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_1km, this.TILEMATRIXSET_ARCTIC_1km),- // SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Aqua_Brightness_Temp_Band31_Day", "MODIS_Aqua_Brightness_Temp_Band31_Day", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-arctic/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-arctic/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-arctic/wmts.cgi"], [512,512], "EPSG:3995", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_1km, this.TILEMATRIXSET_ARCTIC_1km),- // SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Aqua_Brightness_Temp_Band31_Night", "MODIS_Aqua_Brightness_Temp_Band31_Night", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-arctic/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-arctic/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-arctic/wmts.cgi"], [512,512], "EPSG:3995", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_1km, this.TILEMATRIXSET_ARCTIC_1km),-//- // SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Terra_Snow_Cover", "MODIS_Terra_Snow_Cover", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-arctic/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-arctic/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-arctic/wmts.cgi"], [512,512], "EPSG:3995", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_1km, this.TILEMATRIXSET_ARCTIC_500m),- // SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Aqua_Snow_Cover", "MODIS_Aqua_Snow_Cover", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-arctic/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-arctic/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-arctic/wmts.cgi"], [512,512], "EPSG:3995", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_1km, this.TILEMATRIXSET_ARCTIC_500m),-//- // SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Terra_Sea_Ice", "MODIS_Terra_Sea_Ice", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-arctic/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-arctic/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-arctic/wmts.cgi"], [512,512], "EPSG:3995", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_1km, this.TILEMATRIXSET_ARCTIC_1km),- // SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Aqua_Sea_Ice", "MODIS_Aqua_Sea_Ice", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-arctic/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-arctic/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-arctic/wmts.cgi"], [512,512], "EPSG:3995", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_1km, this.TILEMATRIXSET_ARCTIC_1km),- // (product == "arctic_coastlines") ? [{displayName: "arctic_coastlines", wmsProductName: "arctic_coastlines", time:"", format: "image/png", urls:["http://map1a.vis.earthdata.nasa.gov/wmts-arctic/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-arctic/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-arctic/wmts.cgi"], tileSize:[512,512], projection:"EPSG:3995", numZoomLevels:6, maxExtent:[-4194304,-4194304,4194304,4194304], maxResolution:8192.0, tileMatrixSet: this.TILEMATRIXSET_ARCTIC_250m, resolutions: RESOLUTIONS_ON_SCREEN_POLAR_ALL, serverResolutions: RESOLUTIONS_ON_SERVER_POLAR_250m, preferredOpacity: 1.0, bringToFront: true, transitionEffect:"none" }] : [],-- (product == "arctic_coastlines") ? [{displayName: "arctic_coastlines", wmsProductName: "arctic_coastlines", time:"", format: "image/png", urls:["http://map1a.vis.earthdata.nasa.gov/arctic/wms.cgi", "http://map1b.vis.earthdata.nasa.gov/arctic/wms.cgi", "http://map1c.vis.earthdata.nasa.gov/arctic/wms.cgi"], tileSize:[512,512], projection:"EPSG:3995", numZoomLevels:6, maxExtent:[-4194304,-4194304,4194304,4194304], maxResolution:8192.0, resolutions: this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, serverResolutions: this.RESOLUTIONS_ON_SERVER_POLAR_250m, preferredOpacity: 1.0, bringToFront: true, transitionEffect:"none" }] : [],- (product == "grump-v1-population-count_2000") ? [{displayName: "grump-v1-population-count_2000", wmsProductName: "grump-v1-population-count_2000", time:"", format: "image/png", urls:["http://sedac.ciesin.columbia.edu/geoserver/wms?"], projection:"EPSG:3995", preferredOpacity: 0.75, bringToFront: true }] : [],- (product == "polarview:graticuleN") ? [{displayName: "polarview:graticuleN", wmsProductName: "polarview:graticuleN", time:"", urls:["http://geos.polarview.aq/geoserver/wms?"], layers:"polarview:graticuleN", transparent:true, projection:"EPSG:3995", preferredOpacity: 0.75, bringToFront: true }] : [],- (product == "cartographic:national-boundaries") ? [{displayName: "cartographic:national-boundaries", wmsProductName: "cartographic:national-boundaries", time:"", urls:["http://sedac.ciesin.columbia.edu/geoserver/ows"], layers:"cartographic:national-boundaries", transparent:true, projection:"EPSG:3995", preferredOpacity: 0.55, bringToFront: true }] : [],- //{displayName: "coastlines", wmsProductName: "coastlines", time:"", urls:[" http://nsidc.org/cgi-bin/atlas_north?"], layers:"coastlines", transparent:true, projection:"EPSG:32661", preferredOpacity: 0.85, bringToFront: true },- (product == "cartographic:00-global-labels") ? [{displayName: "cartographic:00-global-labels", wmsProductName: "cartographic:00-global-labels", time:"", urls:["http://sedac.ciesin.columbia.edu/geoserver/wms?"], layers:"cartographic:00-global-labels", transparent:true, projection:"EPSG:3995", preferredOpacity: 0.95, bringToFront: true }] : []- ];-- }- else if (this.state == "antarctic")- {- layersToAdd = [- SOTE.util.generateProductLayersForDateRange(product, "MODIS_Terra_CorrectedReflectance_TrueColor", "MODIS_Terra_CorrectedReflectance_TrueColor", "image/jpeg", ["http://map1a.vis.earthdata.nasa.gov/antarctic/wms.cgi", "http://map1b.vis.earthdata.nasa.gov/antarctic/wms.cgi", "http://map1c.vis.earthdata.nasa.gov/antarctic/wms.cgi"], [512,512], "EPSG:3031", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_250m),- SOTE.util.generateProductLayersForDateRange(product, "MODIS_Aqua_CorrectedReflectance_TrueColor", "MODIS_Aqua_CorrectedReflectance_TrueColor", "image/jpeg", ["http://map1a.vis.earthdata.nasa.gov/antarctic/wms.cgi", "http://map1b.vis.earthdata.nasa.gov/antarctic/wms.cgi", "http://map1c.vis.earthdata.nasa.gov/antarctic/wms.cgi"], [512,512], "EPSG:3031", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_250m),- SOTE.util.generateProductLayersForDateRange(product, "MODIS_Terra_CorrectedReflectance_Bands367", "MODIS_Terra_CorrectedReflectance_Bands367", "image/jpeg", ["http://map1a.vis.earthdata.nasa.gov/antarctic/wms.cgi", "http://map1b.vis.earthdata.nasa.gov/antarctic/wms.cgi", "http://map1c.vis.earthdata.nasa.gov/antarctic/wms.cgi"], [512,512], "EPSG:3031", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_250m),-- SOTE.util.generateProductLayersForDateRange(product, "MODIS_Terra_Brightness_Temp_Band31_Day", "MODIS_Terra_Brightness_Temp_Band31_Day", "image/png", ["http://map1a.vis.earthdata.nasa.gov/antarctic/wms.cgi", "http://map1b.vis.earthdata.nasa.gov/antarctic/wms.cgi", "http://map1c.vis.earthdata.nasa.gov/antarctic/wms.cgi"], [512,512], "EPSG:3031", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_1km),- SOTE.util.generateProductLayersForDateRange(product, "MODIS_Terra_Brightness_Temp_Band31_Night", "MODIS_Terra_Brightness_Temp_Band31_Night", "image/png", ["http://map1a.vis.earthdata.nasa.gov/antarctic/wms.cgi", "http://map1b.vis.earthdata.nasa.gov/antarctic/wms.cgi", "http://map1c.vis.earthdata.nasa.gov/antarctic/wms.cgi"], [512,512], "EPSG:3031", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_1km),- SOTE.util.generateProductLayersForDateRange(product, "MODIS_Aqua_Brightness_Temp_Band31_Day", "MODIS_Aqua_Brightness_Temp_Band31_Day", "image/png", ["http://map1a.vis.earthdata.nasa.gov/antarctic/wms.cgi", "http://map1b.vis.earthdata.nasa.gov/antarctic/wms.cgi", "http://map1c.vis.earthdata.nasa.gov/antarctic/wms.cgi"], [512,512], "EPSG:3031", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_1km),- SOTE.util.generateProductLayersForDateRange(product, "MODIS_Aqua_Brightness_Temp_Band31_Night", "MODIS_Aqua_Brightness_Temp_Band31_Night", "image/png", ["http://map1a.vis.earthdata.nasa.gov/antarctic/wms.cgi", "http://map1b.vis.earthdata.nasa.gov/antarctic/wms.cgi", "http://map1c.vis.earthdata.nasa.gov/antarctic/wms.cgi"], [512,512], "EPSG:3031", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_1km),- SOTE.util.generateProductLayersForDateRange(product, "MODIS_Terra_Snow_Cover", "MODIS_Terra_Snow_Cover", "image/png", ["http://map1a.vis.earthdata.nasa.gov/antarctic/wms.cgi", "http://map1b.vis.earthdata.nasa.gov/antarctic/wms.cgi", "http://map1c.vis.earthdata.nasa.gov/antarctic/wms.cgi"], [512,512], "EPSG:3031", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_500m),- SOTE.util.generateProductLayersForDateRange(product, "MODIS_Aqua_Snow_Cover", "MODIS_Aqua_Snow_Cover", "image/png", ["http://map1a.vis.earthdata.nasa.gov/antarctic/wms.cgi", "http://map1b.vis.earthdata.nasa.gov/antarctic/wms.cgi", "http://map1c.vis.earthdata.nasa.gov/antarctic/wms.cgi"], [512,512], "EPSG:3031", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_500m),- SOTE.util.generateProductLayersForDateRange(product, "MODIS_Terra_Sea_Ice", "MODIS_Terra_Sea_Ice", "image/png", ["http://map1a.vis.earthdata.nasa.gov/antarctic/wms.cgi", "http://map1b.vis.earthdata.nasa.gov/antarctic/wms.cgi", "http://map1c.vis.earthdata.nasa.gov/antarctic/wms.cgi"], [512,512], "EPSG:3031", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_1km),- SOTE.util.generateProductLayersForDateRange(product, "MODIS_Aqua_Sea_Ice", "MODIS_Aqua_Sea_Ice", "image/png", ["http://map1a.vis.earthdata.nasa.gov/antarctic/wms.cgi", "http://map1b.vis.earthdata.nasa.gov/antarctic/wms.cgi", "http://map1c.vis.earthdata.nasa.gov/antarctic/wms.cgi"], [512,512], "EPSG:3031", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_1km),- SOTE.util.generateProductLayersForDateRange(product, "NSIDC_Sea_Ice_Concentration", "NSIDC_Sea_Ice_Concentration", "image/png", ["http://map1a.vis.earthdata.nasa.gov/antarctic/wms.cgi", "http://map1b.vis.earthdata.nasa.gov/antarctic/wms.cgi", "http://map1c.vis.earthdata.nasa.gov/antarctic/wms.cgi"], [512,512], "EPSG:3031", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_1km),-- // Commented out until polar WMTSes are ready- // SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Terra_CorrectedReflectance_TrueColor", "MODIS_Terra_CorrectedReflectance_TrueColor", "image/jpeg", ["http://map1a.vis.earthdata.nasa.gov/wmts-antarctic/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-antarctic/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-antarctic/wmts.cgi"], [512,512], "EPSG:3031", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_250m, this.TILEMATRIXSET_ANTARCTIC_250m),- // SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Aqua_CorrectedReflectance_TrueColor", "MODIS_Aqua_CorrectedReflectance_TrueColor", "image/jpeg", ["http://map1a.vis.earthdata.nasa.gov/wmts-antarctic/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-antarctic/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-antarctic/wmts.cgi"], [512,512], "EPSG:3031", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_250m, this.TILEMATRIXSET_ANTARCTIC_250m),- // SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Terra_CorrectedReflectance_Bands367", "MODIS_Terra_CorrectedReflectance_Bands367", "image/jpeg", ["http://map1a.vis.earthdata.nasa.gov/wmts-antarctic/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-antarctic/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-antarctic/wmts.cgi"], [512,512], "EPSG:3031", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_250m, this.TILEMATRIXSET_ANTARCTIC_250m),-//- // SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Terra_Brightness_Temp_Band31_Day", "MODIS_Terra_Brightness_Temp_Band31_Day", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-antarctic/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-antarctic/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-antarctic/wmts.cgi"], [512,512], "EPSG:3031", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_1km, this.TILEMATRIXSET_ANTARCTIC_1km),- // SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Terra_Brightness_Temp_Band31_Night", "MODIS_Terra_Brightness_Temp_Band31_Night", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-antarctic/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-antarctic/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-antarctic/wmts.cgi"], [512,512], "EPSG:3031", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_1km, this.TILEMATRIXSET_ANTARCTIC_1km),- // SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Aqua_Brightness_Temp_Band31_Day", "MODIS_Aqua_Brightness_Temp_Band31_Day", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-antarctic/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-antarctic/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-antarctic/wmts.cgi"], [512,512], "EPSG:3031", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_1km, this.TILEMATRIXSET_ANTARCTIC_1km),- // SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Aqua_Brightness_Temp_Band31_Night", "MODIS_Aqua_Brightness_Temp_Band31_Night", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-antarctic/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-antarctic/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-antarctic/wmts.cgi"], [512,512], "EPSG:3031", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_1km, this.TILEMATRIXSET_ANTARCTIC_1km),-//- // SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Terra_Snow_Cover", "MODIS_Terra_Snow_Cover", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-antarctic/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-antarctic/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-antarctic/wmts.cgi"], [512,512], "EPSG:3031", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_1km, this.TILEMATRIXSET_ANTARCTIC_500m),- // SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Aqua_Snow_Cover", "MODIS_Aqua_Snow_Cover", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-antarctic/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-antarctic/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-antarctic/wmts.cgi"], [512,512], "EPSG:3031", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_1km, this.TILEMATRIXSET_ANTARCTIC_500m),-//- // SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Terra_Sea_Ice", "MODIS_Terra_Sea_Ice", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-antarctic/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-antarctic/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-antarctic/wmts.cgi"], [512,512], "EPSG:3031", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_1km, this.TILEMATRIXSET_ANTARCTIC_1km),- // SOTE.util.generateProductLayersForDateRangeTMS(product, "MODIS_Aqua_Sea_Ice", "MODIS_Aqua_Sea_Ice", "image/png", ["http://map1a.vis.earthdata.nasa.gov/wmts-antarctic/wmts.cgi", "http://map1b.vis.earthdata.nasa.gov/wmts-antarctic/wmts.cgi", "http://map1c.vis.earthdata.nasa.gov/wmts-antarctic/wmts.cgi"], [512,512], "EPSG:3031", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_1km, this.TILEMATRIXSET_ANTARCTIC_1km),-- // (product == "antarctic_coastlines") ? [{displayName: "antarctic_coastlines", wmsProductName: "antarctic_coastlines", time:"", format: "image/png", urls:["http://map2a.vis.earthdata.nasa.gov/wmts-antarctic/wmts.cgi", "http://map2b.vis.earthdata.nasa.gov/wmts-antarctic/wmts.cgi", "http://map2c.vis.earthdata.nasa.gov/wmts-antarctic/wmts.cgi"], tileSize:[512,512], projection:"EPSG:3031", numZoomLevels:6, maxExtent:[-4194304,-4194304,4194304,4194304], maxResolution:8192.0, tileMatrixSet: this.TILEMATRIXSET_ANTARCTIC_250m, resolutions: RESOLUTIONS_ON_SCREEN_POLAR_ALL, serverResolutions: RESOLUTIONS_ON_SERVER_POLAR_250m, preferredOpacity: 1.0, bringToFront: true, transitionEffect:"none" }] : [],-- // SOTE.util.generateProductLayersForDateRange(product, "NSIDC_Sea_Ice_Concentration", "NSIDC_Sea_Ice_Concentration", "image/png", ["http://map1a.vis.earthdata.nasa.gov/antarctic/wms.cgi", "http://map1b.vis.earthdata.nasa.gov/antarctic/wms.cgi", "http://map1c.vis.earthdata.nasa.gov/antarctic/wms.cgi"], [512,512], "EPSG:3031", 6, [-4194304,-4194304,4194304,4194304], 8192.0, 1.0, this.NUM_DAYS_TO_GENERATE, this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, this.RESOLUTIONS_ON_SERVER_POLAR_1km),-- (product == "antarctic_coastlines") ? [{displayName: "antarctic_coastlines", wmsProductName: "antarctic_coastlines", time:"", format: "image/png", urls:["http://map1a.vis.earthdata.nasa.gov/antarctic/wms.cgi", "http://map1b.vis.earthdata.nasa.gov/antarctic/wms.cgi", "http://map1c.vis.earthdata.nasa.gov/antarctic/wms.cgi"], tileSize:[512,512], projection:"EPSG:3031", numZoomLevels:6, maxExtent:[-4194304,-4194304,4194304,4194304], maxResolution:8192.0, resolutions: this.RESOLUTIONS_ON_SCREEN_POLAR_ALL, serverResolutions: this.RESOLUTIONS_ON_SERVER_POLAR_250m, preferredOpacity: 1.0, bringToFront: true, transitionEffect:"none" }] : [],- (product == "grump-v1-population-count_2000") ? [{displayName: "grump-v1-population-count_2000", wmsProductName: "grump-v1-population-count_2000", time:"", format: "image/png", urls:["http://sedac.ciesin.columbia.edu/geoserver/wms?"], projection:"EPSG:3031", preferredOpacity: 0.75, bringToFront: true }] : [],- (product == "polarview:graticule3031_10x30") ? [{displayName: "polarview:graticule3031_10x30", wmsProductName: "polarview:graticule3031_10x30", time:"", urls:["http://geos.polarview.aq/geoserver/wms?"], layers:"polarview:graticule3031_10x30", transparent:true, projection:"EPSG:3031", preferredOpacity: 0.75, bringToFront: true }] : [],- (product == "cartographic:national-boundaries") ? [{displayName: "cartographic:national-boundaries", wmsProductName: "cartographic:national-boundaries", time:"", urls:["http://sedac.ciesin.columbia.edu/geoserver/ows"], layers:"cartographic:national-boundaries", transparent:true, projection:"EPSG:3031", preferredOpacity: 0.55, bringToFront: true }] : [],- (product == "lat_long_grid") ? [{displayName: "lat_long_grid", wmsProductName: "lat_long_grid", time:"", urls:["http://nsidc.org/cgi-bin/atlas_south?"], layers:"lat_long_grid", transparent:true, projection:"EPSG:3031", preferredOpacity: 0.85, bringToFront: true }] : [],- (product == "coastlines") ? [{displayName: "coastlines", wmsProductName: "coastlines", time:"", urls:["http://nsidc.org/cgi-bin/atlas_south?"], layers:"coastlines", transparent:true, projection:"EPSG:3031", preferredOpacity: 0.95, bringToFront: true }] : []- ];- }--- // Load product layer(s) into map- for (var i=0; i<layersToAdd.length; i++)- {- if (layersToAdd[i].length > 0)- {- this.addLayers(layersToAdd[i]);- }- }--}---/**- * Function to manage which layers are currently loaded into the map object.- * This is needed since it causes browser slowdowns to preload all layers into mmeory.- *- * @param querystring querystring from updateComponent- */-SOTE.widget.MapSote.prototype.manageLoadedLayers = function(querystring)-{- // Check for projection state change- var state = (SOTE.util.extractFromQuery("switch",querystring))? SOTE.util.extractFromQuery("switch",querystring): "geographic";- if (state != this.state)- {- this.state = state;- if(this.state == "geographic")- this.projection = "EPSG:4326";- else if(this.state == "antarctic")- this.projection = "EPSG:3031";- else if (this.state == "arctic")- this.projection = "EPSG:3995";-- // Reinitialize map (and thereby remove all existing layers from memory)- this.init();- this.initMapSote();- }--- // Retrieve and compare "updated" products to "old" products- var isProductListDifferent = false;- var updatedProductListQs = (SOTE.util.extractFromQuery("products",querystring));- if (updatedProductListQs != this.terribleProductListSaver)- {- // Products have been updated and map needs to reflect this- isProductListDifferent = true;- this.terribleProductListSaver = updatedProductListQs;- }--- if (isProductListDifferent)- {- // Parse "updated" products- var allActiveLayers = [];- var productsAndBaselayersQs = updatedProductListQs.split("~");- var updatedBaselayerQs = productsAndBaselayersQs[0];- var updatedOverlaysQs = productsAndBaselayersQs[1];- if (updatedBaselayerQs.split(".").length > 1)- {- allActiveLayers.push((updatedBaselayerQs.split("."))[1]);- }-- var numOverlays = updatedOverlaysQs ? updatedOverlaysQs.split(".").length - 1 : 0;- if (numOverlays > 0)- {- for (var i=0; i<numOverlays; i++)- {- allActiveLayers.push((updatedOverlaysQs.split("."))[i+1]);- }- }-- // Define "startsWith" string operator if it doesn't exist- if (typeof String.prototype.startsWith != 'function')- {- String.prototype.startsWith = function (str)- {- return this.slice(0, str.length) == str;- };- }-- // Check if updated products are currently cached- var productsToAdd = [];- for (var i=0; i<allActiveLayers.length; i++)- {- var isProductAlreadyLoaded = false;-- for (var j=0; j<this.map.layers.length; j++)- {- if (this.map.layers[j].name.startsWith(allActiveLayers[i]))- {- isProductAlreadyLoaded = true;- break;- }- }-- if (!isProductAlreadyLoaded)- productsToAdd.push(allActiveLayers[i]);- }-- // Add only the layers that are necessary- for (var i=0; i<productsToAdd.length; i++)- {- this.addProductToMap(productsToAdd[i], state);- }- }--}---/**- * Change the base layers based on dependencies (i.e. extent, date, data product)- *- * Update component with QS.- *- * @this {map}- * @param {String} querystring contains all values of dependencies (from registry)- * @returns {boolean} true or false depending on if the component still validates with the new criteria- *-*/-SOTE.widget.MapSote.prototype.updateComponent = function(querystring)-{-- var state = (SOTE.util.extractFromQuery("switch",querystring))? SOTE.util.extractFromQuery("switch",querystring): "geographic";--- // Manage the currently-loaded layers by adding/removing, as necessary- this.manageLoadedLayers(querystring);--- // Parse querystring- var qs = (querystring === undefined)? "":querystring;-- // Return now if querystring is empty- if (qs == "")- return;--- // Enable layer caching since time has presumably been updated- // TODO: fix this terrible hack- if (!this.terribleQsSaverJustSet)- {- this.setLayerCaching(true);- }- else- {- this.terribleQsSaverJustSet = false;- }--- var activeLayers = SOTE.util.extractFromQuery("products", qs);- var activeTransition = SOTE.util.extractFromQuery("transition", qs);- var activeTime = SOTE.util.extractFromQuery("time", qs);--- // Apply querystring request to map-- // Extract the baselayer and overlays- var activeLayerNames = new Array();- if (activeLayers != ""){- var a = activeLayers.split("~");- var base = a[0].split(".");- var overlays = a[1].split(".");- for(var i=1; i<base.length; ++i){- activeLayerNames.push(base[i]);- }- for(var i=1; i<overlays.length; ++i){- activeLayerNames.push(overlays[i]);- }-- }- if ((activeLayerNames == null) || (activeLayerNames.length < 1))- {- //alert("No products provided in querystring to soteMap class");- return;- }-- // Determine appropriate layer opacities based on currently-selected time-- // Parse and validate time qs- var timeArray = null;- if (activeTime != "")- timeArray = activeTime.split(/T/);- if ((timeArray == null) || (timeArray.length != 2))- {- alert("Invalid or no time provided in querystring to soteMap class; needs to be of the format YYYY-MM-DDTHH:MM:SS");- return;- }-- // Parse date and time from qs- var yyyymmdd = timeArray[0];- var hhmmss = timeArray[1];-- // Parse elements of date and time- var year = yyyymmdd.split("-")[0];- var month = yyyymmdd.split("-")[1];- var day = yyyymmdd.split("-")[2];- var hour = hhmmss.split(":")[0];- var minute = hhmmss.split(":")[1];- var second = hhmmss.split(":")[2];-- // Compute most relevant two time steps- var t0 = new String(yyyymmdd);- var t1Date = Date.parse(t0).add(1).days();- var t1 = new String(t1Date.getFullYear() + "-" + SOTE.util.zeroPad(t1Date.getMonth()+1,2) + "-" + SOTE.util.zeroPad(t1Date.getDate(), 2));-- // Compute the fractional time of day- var fracTimeOfDay = hour/24.0 + minute/1440.0 + second/86400.0;-- // TODO: fix this- // Hack to store current querystring- this.terribleQsSaver = qs;--- // Determine transition type and manipulate layers appropriately- if (activeTransition == "standard")- {- // Don't do any fancy opacity adjustments, just show the date that's closest to time slider position- var selectedDate = null;-// if (fracTimeOfDay < 0.50)- selectedDate = new String(t0);-// else-// selectedDate = new String(t1);-- // Enable layers of selected Date, disable the rest- var allLayers = this.getAllLayers();- var nLayers = allLayers.length;-- // Outer loop through all OpenLayers layers- for (var i=0; i<nLayers; i++)- {- var layerModified = false;-- // Inner loop through all selected layers- for (var j=0; j<activeLayerNames.length; j++)- {- // Enable this layer if string matches zzz- if ((allLayers[i].name == new String(activeLayerNames[j] + "__" + selectedDate)) ||- (allLayers[i].name == new String(activeLayerNames[j])))- {- // Enable the layer- allLayers[i].setVisibility(true);--- // Assume base layer is first element of product list and force it to have the lowest z-index- // (a z-index of 0 is lowest, higher numbers are drawn on top)- // Also: Set opacity to 1.0 for base layer, a fraction of it for overlays (until controls can be made)- if (j==0)- {- this.map.setLayerZIndex(allLayers[i], 0);- allLayers[i].setOpacity(1.0);- }- else- {- // Set Z-layering- if (this.checkWmsParam(allLayers[i].metadata.bringToFront) && allLayers[i].metadata.bringToFront)- this.map.setLayerZIndex(allLayers[i], nLayers-1);-- // Set opacity- if (this.checkWmsParam(allLayers[i].metadata.preferredOpacity))- allLayers[i].setOpacity(allLayers[i].metadata.preferredOpacity);- else- allLayers[i].setOpacity(this.DEFAULT_OVERLAY_OPACITY);- if(activeLayerNames.length > 2){- this.map.setLayerZIndex(allLayers[i],nLayers-j);- }- }-- layerModified = true;- }- }-- // Disable the layer if it hasn't been selected- if (!layerModified)- {- if (!this.isLayerCachingEnabled)- allLayers[i].setVisibility(false);- allLayers[i].setOpacity(0.0);-- // Reset z-index? (assume it is an overlay)- //this.map.setLayerZIndex(allLayers[i], 1);- }- }-- }- else if (activeTransition == "crossfade")- {- // Adjust layer opacities relative to how close the selected time is to the layer dates- alert("crossfade transition not yet supported");- return;- }---};--diff --git a/test/Worldview/Map/testCanvas.js b/test/Worldview/Map/testCanvasTile.jssimilarity index 99%rename from test/Worldview/Map/testCanvas.jsrename to test/Worldview/Map/testCanvasTile.jsindex e278f1b80..89b3e323b 100644--- a/test/Worldview/Map/testCanvas.js+++ b/test/Worldview/Map/testCanvasTile.js@@ -57,6 +57,7 @@ TestCase("CanvasTile", {};},+ /*testDestroyRemovesCanvas: function() {tile.canvas = "canvas";tile.destroy();@@ -77,13 +78,13 @@ TestCase("CanvasTile", {tile.clear();assertFalse(OpenLayers.Element.hasClass("olImageLoadError"));},-+testGetCanvasCreatesCanvas: function() {assertNull(tile.canvas);var canvas = tile.getCanvas();assertNotNull(tile.canvas);},-+testOnImageLoadUsesLookupTable: function() {tile.canvas = mockCanvas;@@ -103,5 +104,6 @@ TestCase("CanvasTile", {assertEquals(0x07, mockImageData[2]);assertEquals(0x08, mockImageData[3]);},+ */});diff --git a/test/Worldview/testScheduler.js b/test/Worldview/testScheduler.jsnew file mode 100644index 000000000..e8b67690e--- /dev/null+++ b/test/Worldview/testScheduler.js@@ -0,0 +1,86 @@+/*+ * NASA Worldview+ *+ * This code was originally developed at NASA/Goddard Space Flight Center for+ * the Earth Science Data and Information System (ESDIS) project.+ *+ * Copyright (C) 2013 United States Government as represented by the+ * Administrator of the National Aeronautics and Space Administration.+ * All Rights Reserved.+ */++TestCase("Scheduler", TestSuite.Tests({++ setUp: function() {+ },++ // Check that a job's callback is invoked when completed.+ testExecute: function() {+ var callbackInvoked = false;+ var factory = function() {+ var target = {+ onSuccess: null,+ addEventListener: function(type, callback) {+ if ( type === "message" ) {+ onSuccess = callback;+ }+ },+ postMessage: function(message) {+ onSuccess({+ target: target,+ data: {+ id: message.id,+ status: "success"+ }+ });+ }+ };+ return target;+ }++ var scheduler = new Worldview.Scheduler({+ factory: factory+ });+ scheduler.submit({+ callback: function() {+ callbackInvoked = true;+ }+ });+ assertTrue(callbackInvoked);+ },++ // Check that a job' callback is invoked on an error.+ testFailure: function() {+ var callbackInvoked = false;+ var factory = function() {+ var target = {+ onError: null,+ addEventListener: function(type, callback) {+ if ( type === "error" ) {+ onError = callback;+ }+ },+ postMessage: function(message) {+ onError({+ target: target,+ data: {+ id: message.id+ }+ });+ }+ }+ return target;+ };++ var scheduler = new Worldview.Scheduler({+ factory: factory+ });+ scheduler.submit({+ callback: function() {+ callbackInvoked = true;+ }+ });+ assertTrue(callbackInvoked);+ }++}));diff --git a/test/jsTestDriver.conf b/test/jsTestDriver.confindex d746b92e9..c13748643 100644--- a/test/jsTestDriver.conf+++ b/test/jsTestDriver.conf@@ -18,6 +18,7 @@ load:- ../js/Logging.js- ../js/Worldview.js- ../js/Worldview/Permalink.js+ - ../js/Worldview/Scheduler.js- ../js/Worldview/Palette.js- ../js/Worldview/Palette/*.js- ../js/Worldview/Widget/*.js@@ -26,8 +27,6 @@ load:- ../js/component.js- ../js/registry.js- ../js/util.js- - ../js/map.js- - ../js/mapSote.js- ../js/dateSpan.js- ../js/rubberBand.js- ../js/imageDownload.js@@ -37,12 +36,15 @@ load:- ../js/switch.js- ../js/selector.js+exclude:+ - ../js/Worldview/Map/LookupWorker.js+test:- testLogging.js- testWorldview.js- Worldview/*.js- Worldview/Palette/*.js- Worldview/TestSuite/*.js-+timeout: 30\ No newline at end of filediff --git a/test/testLogging.js b/test/testLogging.jsindex 074210367..68b6356f9 100644--- a/test/testLogging.js+++ b/test/testLogging.js@@ -12,7 +12,6 @@TestCase("Logging.standard", TestSuite.Tests({patcher: null,- mockConsole: null,setUp: function() {patcher = TestSuite.Patcher();@@ -20,15 +19,15 @@ TestCase("Logging.standard", TestSuite.Tests({tearDown: function() {patcher.undo();- Logging.undebug("foo");Logging.undebug();+ Logging.reset();},// Check that it passes through to the correct objecttestMessage: function() {var mockLog = mockFunction();patcher.apply("console.log", mockLog);- Logging.getLogger().message("log");+ Logging.getLogger("testMessage").message("log");verify(mockLog)("log");},@@ -36,7 +35,7 @@ TestCase("Logging.standard", TestSuite.Tests({testError: function() {var mockError = mockFunction();patcher.apply("console.error", mockError);- Logging.getLogger().error("error");+ Logging.getLogger("testError").error("error");verify(mockError)("error");},@@ -44,7 +43,7 @@ TestCase("Logging.standard", TestSuite.Tests({testInfo: function() {var mockInfo = mockFunction();patcher.apply("console.info", mockInfo);- Logging.getLogger().info("info");+ Logging.getLogger("testInfo").info("info");verify(mockInfo)("info");},@@ -52,7 +51,7 @@ TestCase("Logging.standard", TestSuite.Tests({testWarn: function() {var mockWarn = mockFunction();patcher.apply("console.warn", mockWarn);- Logging.getLogger().warn("warn");+ Logging.getLogger("testWarn").warn("warn");verify(mockWarn)("warn");},@@ -60,7 +59,7 @@ TestCase("Logging.standard", TestSuite.Tests({testTrace: function() {var mockTrace = mockFunction();patcher.apply("console.trace", mockTrace);- Logging.getLogger().trace();+ Logging.getLogger("testTrace").trace();verify(mockTrace)();},@@ -68,7 +67,7 @@ TestCase("Logging.standard", TestSuite.Tests({testDebugDisabled: function() {var mockLog = mockFunction();patcher.apply("console.log", mockLog);- Logging.getLogger("foo").debug("foo");+ Logging.getLogger("testDebugDisabled").debug("foo");verifyZeroInteractions(mockLog);},@@ -76,35 +75,20 @@ TestCase("Logging.standard", TestSuite.Tests({testDebugEnabled: function() {var mockLog = mockFunction();patcher.apply("console.log", mockLog);- Logging.debug("foo");- Logging.getLogger("foo").debug("foo");+ Logging.debug("testDebugEnabled");+ Logging.getLogger("testDebugEnabled").debug("foo");verify(mockLog)("foo");},-- // Check for no output for debug with no namespace- testDebugDisabledNoNamespace: function() {- var mockLog = mockFunction();- patcher.apply("console.log", mockLog);- Logging.getLogger().debug("foo");- verifyZeroInteractions(mockLog);- },- // Check for output when all debughing is enabled with no namespace- testAllDebugEnabledNoNamespace: function() {- var mockLog = mockFunction();- patcher.apply("console.log", mockLog);- Logging.debug();- Logging.getLogger().debug("foo");- verify(mockLog)("foo");- },-- // Check for output when all debugging is enabled with namespace+ // Check for output when all debuggingtestAllDebugEnabled: function() {var mockLog = mockFunction();patcher.apply("console.log", mockLog);Logging.debug();- Logging.getLogger("foo").debug("foo");+ Logging.getLogger("testAllDebugE").debug("foo");+ Logging.getLogger("bar").debug("bar");verify(mockLog)("foo");+ verify(mockLog)("bar");}}));@@ -120,6 +104,7 @@ TestCase("Logging.noConsole", TestSuite.Tests({tearDown: function() {patcher.undo();+ Logging.reset();},// Test that no errors are thrown when console is undefined@@ -150,6 +135,7 @@ TestCase("Logging.onlyLog", TestSuite.Tests({tearDown: function() {patcher.undo();+ Logging.reset();},// Check that log is called when error is not defineddiff --git a/test/testWorldview.js b/test/testWorldview.jsindex 325f99872..35aae1f69 100644--- a/test/testWorldview.js+++ b/test/testWorldview.js@@ -57,7 +57,9 @@ TestCase("Worldview.error", TestSuite.Tests({mockPanel: null,mockLog: null,- setUp: function() {+ setUp: function() {+ Logging.reset();+// Mock out the panel that is displayed on an errorvar mockPanelConstructor = mockFunction();mockPanel = mock(YAHOO.widget.Panel);@@ -92,8 +94,9 @@ TestCase("Worldview.error", TestSuite.Tests({// Check that error with cause is written to consoletestErrorWithCause: function() {- Worldview.error("This is an error", "with a cause");- verify(mockLog)("This is an error: with a cause");+ var e = new Error("with a cause");+ Worldview.error("This is an error", e);+ verify(mockLog)(e);},// Check that the cause is not placed in the dialog@@ -110,6 +113,8 @@ TestCase("Worldview.error.withoutYahoo", TestSuite.Tests({patcher: null,setUp: function() {+ Logging.reset();+patcher = TestSuite.Patcher();patcher.apply("console.error", mockFunction());patcher.apply("YAHOO", {});