Interactive interface for browsing global, full-resolution satellite imagery
Updated generateProductLayersForDateRange so that it includes parameters to pass arrays of the screen resolution and server-side resolution which then allow "overzooming" of lower-resolution layers; renamed original function to generateProductLayersForDateRangeNoOversample so that you can still create layers without oversampling.
Ryan Boller693c9b545a5c
diff --git a/js/util.js b/js/util.jsindex 4c45a53a3..437c9e301 100644--- a/js/util.js+++ b/js/util.js@@ -145,11 +145,13 @@ SOTE.util.DayNameFromUTCDayInt = function(dayOfWeekInt)* @param maxResolutionFloat max resolution of the data (degrees/pixel)* @param preferredOpacity preferred opacity for this layer [0.0, 1.0]* @param numDays number of days to generate; i.e., a value of 3 would generate today, yesterday, and two days ago+ * @param screenResolutionsArr an array of screen resolutions that this layer should support+ * @param serverResolutionsArr an array of resolutions that are available for this layer on the server** @returns an array whose elements contain a single day of the specified product**/-SOTE.util.generateProductLayersForDateRange = function(displayNameStr, wmsProductNameStr, formatStr, urlsArr, tileSizeArr, projectionStr, numZoomLevelsInt, maxExtentArr, maxResolutionFloat, preferredOpacityFloat, numDays)+SOTE.util.generateProductLayersForDateRange = function(displayNameStr, wmsProductNameStr, formatStr, urlsArr, tileSizeArr, projectionStr, numZoomLevelsInt, maxExtentArr, maxResolutionFloat, preferredOpacityFloat, numDays, screenResolutionsArr, serverResolutionsArr){// Get current date@@ -167,6 +169,7 @@ SOTE.util.generateProductLayersForDateRange = function(displayNameStr, wmsProducreturnArr[i] = {displayName: (displayNameStr + "__" + dateStr), wmsProductName: wmsProductNameStr,time: dateStr, format: formatStr, urls: urlsArr, tileSize: tileSizeArr, projection: projectionStr,numZoomLevels: numZoomLevelsInt, maxExtent: maxExtentArr, maxResolution: maxResolutionFloat,+ resolutions: screenResolutionsArr, serverResolutions: serverResolutionsArr,preferredOpacity: preferredOpacityFloat };// Compute next date value by subtracting one day (in ms) from currently stored value@@ -177,3 +180,59 @@ SOTE.util.generateProductLayersForDateRange = function(displayNameStr, wmsProducreturn returnArr;}++++/**+ * Generates an array of OpenLayers layers for the specified product: one for each+ * day starting from the current day, working backwards for a total of numDays.+ *+ * "NoOversample" means that if the server doesn't contain imagery for the+ * requested zoom level, no imagery will be displayed+ *+ *+ * @param displayNameStr name shown in OL layer list; mostly for debugging at this point+ * @param wmsProductNameStr the product name recognized by the WMS server+ * @param formatStr the type of image format expected in return, e.g., "image/jpeg"+ * @param urlsArr an array containing a set of URLs to the WMS; multiple array entries can be provided to allow more parallel access to WMS server+ * @param tileSizeArr a 2-entry integer array containing the tile dimensions in pixels+ * @param projectionStr string containing the projection, e.g., "EPSG:4326"+ * @param numZoomLevelsInt number of zoom levels contained in the data+ * @param maxExtentArr a 4-entry array containing the max extent of the layer+ * @param maxResolutionFloat max resolution of the data (degrees/pixel)+ * @param preferredOpacity preferred opacity for this layer [0.0, 1.0]+ * @param numDays number of days to generate; i.e., a value of 3 would generate today, yesterday, and two days ago+ *+ * @returns an array whose elements contain a single day of the specified product+ *+ */+SOTE.util.generateProductLayersForDateRangeNoOversample = function(displayNameStr, wmsProductNameStr, formatStr, urlsArr, tileSizeArr, projectionStr, numZoomLevelsInt, maxExtentArr, maxResolutionFloat, preferredOpacityFloat, numDays)+{++ // Get current date+ var curDate = new Date();++ // Generate layer for each day+ var returnArr = new Array(numDays);+ for (var i=0; i<numDays; i++)+ {+ // Generate YYYY-MM-DD string+ var dateStr = curDate.getUTCFullYear() + "-" + SOTE.util.zeroPad(eval(curDate.getUTCMonth()+1),2) + "-" ++ SOTE.util.zeroPad(curDate.getUTCDate(),2);++ // Generate layer entry+ returnArr[i] = {displayName: (displayNameStr + "__" + dateStr), wmsProductName: wmsProductNameStr,+ time: dateStr, format: formatStr, urls: urlsArr, tileSize: tileSizeArr, projection: projectionStr,+ numZoomLevels: numZoomLevelsInt, maxExtent: maxExtentArr, maxResolution: maxResolutionFloat,+ preferredOpacity: preferredOpacityFloat };++ // Compute next date value by subtracting one day (in ms) from currently stored value+ curDate = new Date(curDate - (1000*60*60*24));+ }+++ return returnArr;+}+++