Skip to content
Snippets Groups Projects
Commit c8093b93 authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Support nested layers from GeoServer

parent e06559a3
No related branches found
No related tags found
No related merge requests found
......@@ -57,7 +57,7 @@ async function switchLayer(dayIndex)
if(layers[i].getVisible())
{
// See if there is a language specific legend available
if(currentLayer.Abstract != undefined)
if(currentLayer.Abstract != undefined && currentLayer.Abstract.trim() != "")
{
document.getElementById("layerLegend").innerHTML= getLegendHTML(currentLayer.Abstract);
}
......@@ -189,6 +189,20 @@ async function initGridMap(inputModelId, wmsURL, mapAttribution) {
//console.info(txt);
let capabilities = parser.read(txt);
let WMSLayers = capabilities.Capability.Layer.Layer;
// Test: Are WMSLayers one level behind?
let testName = WMSLayers[0].Name;
let testNameParts = testName.split(".");
// The name must have 3 parts
// Part 1 of name must equal the model ID
// Part 3 must be a parseable date (YYYY-MM-DD)
if(testNameParts.length != 3 || testNameParts[0] != modelId || testNameParts[2].length != 10)
{
// This is not the layer we want, we must search one level deeper.
WMSLayers = WMSLayers[0].Layer;
}
//console.info(WMSLayers);
document.getElementById("modelTitle").innerHTML = capabilities.Service.Title;
if(capabilities.Service.Abstract != undefined)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment