From c3510948fd16fff3e6e26119d0b71fab4446c1ec Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Sun, 10 Nov 2019 13:52:45 +0100 Subject: [PATCH] Add script function to easily add GIBS image layers to Earth --- ext/ghoul | 2 +- .../globebrowsing/scripts/layer_support.lua | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/ext/ghoul b/ext/ghoul index 38272a9b7d..e6ef5101e7 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit 38272a9b7d30bc07656336d35cbaae3a24ffd4bb +Subproject commit e6ef5101e7dd5e5ba19329ed9f5e5806e257b5ed diff --git a/modules/globebrowsing/scripts/layer_support.lua b/modules/globebrowsing/scripts/layer_support.lua index d76864112f..4ac0cf6971 100644 --- a/modules/globebrowsing/scripts/layer_support.lua +++ b/modules/globebrowsing/scripts/layer_support.lua @@ -48,6 +48,16 @@ openspace.globebrowsing.documentation = { "}" .. ")" }, + { + Name = "addGibsLayer", + Arguments = "string, string, string, string, string", + Documentation = "Adds a new layer from NASA GIBS to the Earth globe. Arguments " .. + "are: imagery layer name, imagery resolution, start date, end date, format. " .. + "For all specifications, see " .. + "https://wiki.earthdata.nasa.gov/display/GIBS/GIBS+Available+Imagery+Products" .. + "Usage:" .. + "openspace.globebrowsing.addGibsLayer('AIRS_Temperature_850hPa_Night', '2km', '2013-07-15', 'Present', 'png')" + }, { Name = "parseInfoFile", Arguments = "string", @@ -97,6 +107,14 @@ openspace.globebrowsing.documentation = { } } +openspace.globebrowsing.addGibsLayer = function(layer, resolution, format, startDate, endDate) + if endDate == 'Present' then + endDate = '' + end + local xml = openspace.globebrowsing.createTemporalGibsGdalXml(layer, startDate, endDate, '1d', resolution, format) + openspace.globebrowsing.addLayer('Earth', 'ColorLayers', { Identifier = layer, Type = "TemporalTileLayer", FilePath = xml }) +end + openspace.globebrowsing.createTemporalGibsGdalXml = function (layerName, startDate, endDate, timeResolution, resolution, format) temporalTemplate = "" .. @@ -332,5 +350,4 @@ openspace.globebrowsing.loadWMSServersFromFile = function (file_path) ) end end - end