diff --git a/packages/geoview-core/public/configs/navigator/14-wms-layer.json b/packages/geoview-core/public/configs/navigator/14-wms-layer.json index 98af18fd3cc..fb446f5b70b 100644 --- a/packages/geoview-core/public/configs/navigator/14-wms-layer.json +++ b/packages/geoview-core/public/configs/navigator/14-wms-layer.json @@ -10,6 +10,26 @@ "labeled": true }, "listOfGeoviewLayerConfig": [ + { + "geoviewLayerId": "Hydro", + "geoviewLayerName": "Hydro - Scale" , + "metadataAccessPath": "https://maps.geogratis.gc.ca/wms/hydro_network_en", + "geoviewLayerType": "ogcWms", + "listOfLayerEntryConfig": [ + { + "layerId": "nhn:nhn", + "layerName": "National Hydro Network (NHN)" + }, + { + "layerId": "nhn:nhnda", + "layerName": "Drainage Areas" + }, + { + "layerId": "nhn:toponyms", + "layerName": "Toponyms" + } + ] + }, { "geoviewLayerId": "wmsLYR1-Root", "geoviewLayerName": "Weather Group", @@ -91,6 +111,17 @@ } } ] + }, + { + "geoviewLayerId": "LYR1", + "geoviewLayerName": "Canada Energy Regulator", + "metadataAccessPath": "https://maps-cartes.services.geo.ca/server_serveur/services/NRCan/CER_Assessments_EN/MapServer/WMSServer", + "geoviewLayerType": "ogcWms", + "listOfLayerEntryConfig": [ + { + "layerId": "0" + } + ] } ] }, diff --git a/packages/geoview-core/public/configs/navigator/16-esri-dynamic.json b/packages/geoview-core/public/configs/navigator/16-esri-dynamic.json index f80d9f4698a..6b0d30b5f3e 100644 --- a/packages/geoview-core/public/configs/navigator/16-esri-dynamic.json +++ b/packages/geoview-core/public/configs/navigator/16-esri-dynamic.json @@ -214,6 +214,213 @@ "layerId": "0" } ] + }, + { + "geoviewLayerId": "classBreaksId", + "geoviewLayerName": "classBreaks", + "metadataAccessPath": "https://maps-cartes.ec.gc.ca/arcgis/rest/services/DMS/CSO_volume/MapServer/", + "geoviewLayerType": "esriDynamic", + "listOfLayerEntryConfig": [ + { + "layerId": "8", + "layerFilter": "Total_CSO_Volume > 5000000", + "style": { + "Point": { + "styleId": "classBreaksId", + "styleType": "classBreaks", + "defaultLabel": "Pas de données de volume / No volume data", + "defaultSettings": { + "symbol": "square", + "type": "simpleSymbol", + "color": "rgba(255,127,127,1)", + "offset": [0, 0], + "rotation": 0, + "size": 2.0010000000000003, + "stroke": { + "color": "rgba(0,0,0,1)", + "lineStyle": "solid", + "width": 0.5 + } + }, + "defaultVisible": true, + "field": "Total_CSO_Volume", + "classBreakStyleInfo": [ + { + "label": "0 m3", + "minValue": 0, + "maxValue": 0, + "visible": true, + "settings": { + "symbol": "circle", + "type": "simpleSymbol", + "color": "rgba(76,230,0,1)", + "offset": [0, 0], + "rotation": 0, + "size": 2.6679999999999997, + "stroke": { + "color": "rgba(0,0,0,1)", + "lineStyle": "solid", + "width": 0.5 + } + } + }, + { + "label": "0.0001 - ≤ 5,000,000 m3", + "minValue": 0, + "maxValue": 5000000, + "visible": true, + "settings": { + "symbol": "circle", + "type": "simpleSymbol", + "color": "rgba(196,97,255,1)", + "offset": [0, 0], + "rotation": 0, + "size": 5.114407777777778, + "stroke": { + "color": "rgba(0,0,0,1)", + "lineStyle": "solid", + "width": 0.5 + } + } + }, + { + "label": "> 5,000,000 - ≤ 10,000,000 m3", + "minValue": 5000000, + "maxValue": 10000000, + "visible": true, + "settings": { + "symbol": "circle", + "type": "simpleSymbol", + "color": "rgba(196,97,255,1)", + "offset": [0, 0], + "rotation": 0, + "size": 7.560815555555555, + "stroke": { + "color": "rgba(0,0,0,1)", + "lineStyle": "solid", + "width": 0.5 + } + } + }, + { + "label": "> 10,000,000 - ≤ 15,000,000 m3", + "minValue": 10000000, + "maxValue": 15000000, + "visible": true, + "settings": { + "symbol": "circle", + "type": "simpleSymbol", + "color": "rgba(196,97,255,1)", + "offset": [0, 0], + "rotation": 0, + "size": 10.007223333333332, + "stroke": { + "color": "rgba(0,0,0,1)", + "lineStyle": "solid", + "width": 0.5 + } + } + }, + { + "label": "> 15,000,000 - ≤ 20,000,000 m3", + "minValue": 15000000, + "maxValue": 20000000, + "visible": true, + "settings": { + "symbol": "circle", + "type": "simpleSymbol", + "color": "rgba(196,97,255,1)", + "offset": [0, 0], + "rotation": 0, + "size": 12.453631111111111, + "stroke": { + "color": "rgba(0,0,0,1)", + "lineStyle": "solid", + "width": 0.5 + } + } + }, + { + "label": "> 20,000,000 - ≤ 25,000,000 m3", + "minValue": 20000000, + "maxValue": 25000000, + "visible": true, + "settings": { + "symbol": "circle", + "type": "simpleSymbol", + "color": "rgba(196,97,255,1)", + "offset": [0, 0], + "rotation": 0, + "size": 14.90003888888889, + "stroke": { + "color": "rgba(0,0,0,1)", + "lineStyle": "solid", + "width": 0.5 + } + } + }, + { + "label": "> 25,000,000 - ≤ 30,000,000 m3", + "minValue": 25000000, + "maxValue": 30000000, + "visible": true, + "settings": { + "symbol": "circle", + "type": "simpleSymbol", + "color": "rgba(196,97,255,1)", + "offset": [0, 0], + "rotation": 0, + "size": 17.346446666666665, + "stroke": { + "color": "rgba(0,0,0,1)", + "lineStyle": "solid", + "width": 0.5 + } + } + }, + { + "label": "> 30,000,000 - ≤ 35,000,000 m3", + "minValue": 30000000, + "maxValue": 35000000, + "visible": true, + "settings": { + "symbol": "circle", + "type": "simpleSymbol", + "color": "rgba(196,97,255,1)", + "offset": [0, 0], + "rotation": 0, + "size": 19.792854444444444, + "stroke": { + "color": "rgba(0,0,0,1)", + "lineStyle": "solid", + "width": 0.5 + } + } + }, + { + "label": "> 35,000,000 m3", + "minValue": 35000000, + "maxValue": 999000000, + "visible": true, + "settings": { + "symbol": "circle", + "type": "simpleSymbol", + "color": "rgba(196,97,255,1)", + "offset": [0, 0], + "rotation": 0, + "size": 22.239262222222223, + "stroke": { + "color": "rgba(0,0,0,1)", + "lineStyle": "solid", + "width": 0.5 + } + } + } + ] + } + } + } + ] } ] }, diff --git a/packages/geoview-core/public/configs/navigator/17-esri-feature.json b/packages/geoview-core/public/configs/navigator/17-esri-feature.json index 7e4981703c3..80155137948 100644 --- a/packages/geoview-core/public/configs/navigator/17-esri-feature.json +++ b/packages/geoview-core/public/configs/navigator/17-esri-feature.json @@ -43,6 +43,213 @@ "layerId": "0" } ] + }, + { + "geoviewLayerId": "classBreaksId", + "geoviewLayerName": "classBreaks", + "metadataAccessPath": "https://maps-cartes.ec.gc.ca/arcgis/rest/services/DMS/CSO_volume/MapServer/", + "geoviewLayerType": "esriFeature", + "listOfLayerEntryConfig": [ + { + "layerId": "8", + "layerFilter": "Total_CSO_Volume > 5000000", + "style": { + "Point": { + "styleId": "classBreaksId", + "styleType": "classBreaks", + "defaultLabel": "Pas de données de volume / No volume data", + "defaultSettings": { + "symbol": "square", + "type": "simpleSymbol", + "color": "rgba(255,127,127,1)", + "offset": [0, 0], + "rotation": 0, + "size": 2.0010000000000003, + "stroke": { + "color": "rgba(0,0,0,1)", + "lineStyle": "solid", + "width": 0.5 + } + }, + "defaultVisible": true, + "field": "Total_CSO_Volume", + "classBreakStyleInfo": [ + { + "label": "0 m3", + "minValue": 0, + "maxValue": 0, + "visible": true, + "settings": { + "symbol": "circle", + "type": "simpleSymbol", + "color": "rgba(76,230,0,1)", + "offset": [0, 0], + "rotation": 0, + "size": 2.6679999999999997, + "stroke": { + "color": "rgba(0,0,0,1)", + "lineStyle": "solid", + "width": 0.5 + } + } + }, + { + "label": "0.0001 - ≤ 5,000,000 m3", + "minValue": 0, + "maxValue": 5000000, + "visible": true, + "settings": { + "symbol": "circle", + "type": "simpleSymbol", + "color": "rgba(196,97,255,1)", + "offset": [0, 0], + "rotation": 0, + "size": 5.114407777777778, + "stroke": { + "color": "rgba(0,0,0,1)", + "lineStyle": "solid", + "width": 0.5 + } + } + }, + { + "label": "> 5,000,000 - ≤ 10,000,000 m3", + "minValue": 5000000, + "maxValue": 10000000, + "visible": true, + "settings": { + "symbol": "circle", + "type": "simpleSymbol", + "color": "rgba(196,97,255,1)", + "offset": [0, 0], + "rotation": 0, + "size": 7.560815555555555, + "stroke": { + "color": "rgba(0,0,0,1)", + "lineStyle": "solid", + "width": 0.5 + } + } + }, + { + "label": "> 10,000,000 - ≤ 15,000,000 m3", + "minValue": 10000000, + "maxValue": 15000000, + "visible": true, + "settings": { + "symbol": "circle", + "type": "simpleSymbol", + "color": "rgba(196,97,255,1)", + "offset": [0, 0], + "rotation": 0, + "size": 10.007223333333332, + "stroke": { + "color": "rgba(0,0,0,1)", + "lineStyle": "solid", + "width": 0.5 + } + } + }, + { + "label": "> 15,000,000 - ≤ 20,000,000 m3", + "minValue": 15000000, + "maxValue": 20000000, + "visible": true, + "settings": { + "symbol": "circle", + "type": "simpleSymbol", + "color": "rgba(196,97,255,1)", + "offset": [0, 0], + "rotation": 0, + "size": 12.453631111111111, + "stroke": { + "color": "rgba(0,0,0,1)", + "lineStyle": "solid", + "width": 0.5 + } + } + }, + { + "label": "> 20,000,000 - ≤ 25,000,000 m3", + "minValue": 20000000, + "maxValue": 25000000, + "visible": true, + "settings": { + "symbol": "circle", + "type": "simpleSymbol", + "color": "rgba(196,97,255,1)", + "offset": [0, 0], + "rotation": 0, + "size": 14.90003888888889, + "stroke": { + "color": "rgba(0,0,0,1)", + "lineStyle": "solid", + "width": 0.5 + } + } + }, + { + "label": "> 25,000,000 - ≤ 30,000,000 m3", + "minValue": 25000000, + "maxValue": 30000000, + "visible": true, + "settings": { + "symbol": "circle", + "type": "simpleSymbol", + "color": "rgba(196,97,255,1)", + "offset": [0, 0], + "rotation": 0, + "size": 17.346446666666665, + "stroke": { + "color": "rgba(0,0,0,1)", + "lineStyle": "solid", + "width": 0.5 + } + } + }, + { + "label": "> 30,000,000 - ≤ 35,000,000 m3", + "minValue": 30000000, + "maxValue": 35000000, + "visible": true, + "settings": { + "symbol": "circle", + "type": "simpleSymbol", + "color": "rgba(196,97,255,1)", + "offset": [0, 0], + "rotation": 0, + "size": 19.792854444444444, + "stroke": { + "color": "rgba(0,0,0,1)", + "lineStyle": "solid", + "width": 0.5 + } + } + }, + { + "label": "> 35,000,000 m3", + "minValue": 35000000, + "maxValue": 999000000, + "visible": true, + "settings": { + "symbol": "circle", + "type": "simpleSymbol", + "color": "rgba(196,97,255,1)", + "offset": [0, 0], + "rotation": 0, + "size": 22.239262222222223, + "stroke": { + "color": "rgba(0,0,0,1)", + "lineStyle": "solid", + "width": 0.5 + } + } + } + ] + } + } + } + ] } ] }, diff --git a/packages/geoview-core/public/configs/navigator/20-wfs.json b/packages/geoview-core/public/configs/navigator/20-wfs.json index fcf84317c33..daeb02b100b 100644 --- a/packages/geoview-core/public/configs/navigator/20-wfs.json +++ b/packages/geoview-core/public/configs/navigator/20-wfs.json @@ -35,6 +35,19 @@ "layerName": "Current Conditions" } ] + }, + { + "geoviewLayerId": "wfsLYR4", + "geoviewLayerName": "USGS mrds bbox strategy", + "metadataAccessPath": "https://mrdata.usgs.gov/services/wfs/mrds?request=GetCapabilities&service=WFS&version=1.1.0", + "geoviewLayerType": "ogcWfs", + "listOfLayerEntryConfig": [ + { + "layerId": "mrds", + "source": { "strategy": "bbox" }, + "layerName": "USGS mrds" + } + ] } ] }, diff --git a/packages/geoview-core/public/configs/navigator/28-geocore.json b/packages/geoview-core/public/configs/navigator/28-geocore.json new file mode 100644 index 00000000000..4d265953b33 --- /dev/null +++ b/packages/geoview-core/public/configs/navigator/28-geocore.json @@ -0,0 +1,50 @@ +{ + "map": { + "interaction": "dynamic", + "viewSettings": { + "projection": 3978 + }, + "basemapOptions": { + "basemapId": "transport", + "shaded": true, + "labeled": false + }, + "listOfGeoviewLayerConfig": [ + { + "geoviewLayerType": "geoCore", + "geoviewLayerId": "21b821cf-0f1c-40ee-8925-eab12d357668" + }, + { + "geoviewLayerType": "geoCore", + "geoviewLayerId": "ccc75c12-5acc-4a6a-959f-ef6f621147b9" + }, + { + "geoviewLayerType": "geoCore", + "geoviewLayerId": "0fca08b5-e9d0-414b-a3c4-092ff9c5e326" + }, + { + "geoviewLayerType": "geoCore", + "geoviewLayerId": "03ccfb5c-a06e-43e3-80fd-09d4f8f69703" + } + ] + }, + "components": [ + "overview-map" + ], + "overviewMap": { + "hideOnZoom": 7 + }, + "footerBar": { + "tabs": { + "core": [ + "legend", + "layers", + "details", + "geochart", + "data-table" + ] + } + }, + "corePackages": [], + "theme": "geo.ca" +} \ No newline at end of file diff --git a/packages/geoview-core/public/configs/navigator/29-geopackages.json b/packages/geoview-core/public/configs/navigator/29-geopackages.json new file mode 100644 index 00000000000..8ef252f2af1 --- /dev/null +++ b/packages/geoview-core/public/configs/navigator/29-geopackages.json @@ -0,0 +1,69 @@ +{ + "map": { + "interaction": "dynamic", + "viewSettings": { + "projection": 3978 + }, + "basemapOptions": { + "basemapId": "transport", + "shaded": true, + "labeled": false + }, + "listOfGeoviewLayerConfig": [ + { + "geoviewLayerId": "GeoPackageLYR1", + "geoviewLayerName": "Natural Earth", + "geoviewLayerType": "GeoPackage", + "listOfLayerEntryConfig": [ + { + "layerId": "Natural_Earth_QGIS_layers_and_styles.gpkg", + "layerName": "Natural Earth", + "source": { + "dataAccessPath": "./datasets/geopackages" + } + } + ] + }, + { + "geoviewLayerId": "GeoPackageLYR2", + "geoviewLayerName": "Rivers and Canals", + "geoviewLayerType": "GeoPackage", + "listOfLayerEntryConfig": [ + { + "layerId": "QGIS Packaged Layers (D+S Canal).gpkg", + "layerName": "D+S Canal", + "source": { + "dataAccessPath": "./datasets/geopackages" + } + }, + { + "layerId": "rivers.gpkg", + "layerName": "Rivers", + "source": { + "dataAccessPath": "./datasets/geopackages" + } + } + ] + } + ] + }, + "components": [ + "overview-map" + ], + "overviewMap": { + "hideOnZoom": 7 + }, + "footerBar": { + "tabs": { + "core": [ + "legend", + "layers", + "details", + "geochart", + "data-table" + ] + } + }, + "corePackages": [], + "theme": "geo.ca" +} \ No newline at end of file diff --git a/packages/geoview-core/public/css/style.css b/packages/geoview-core/public/css/style.css index 8b799c3d473..253d96f945f 100644 --- a/packages/geoview-core/public/css/style.css +++ b/packages/geoview-core/public/css/style.css @@ -28,6 +28,7 @@ td { color: white; cursor: pointer; padding: 18px; + margin: 3px 0px; width: 100%; border: none; text-align: left; @@ -42,12 +43,12 @@ td { .panel { display: none; - width: 100%; background: #ffffff; + margin: 2px 0px 5px 0px; box-shadow: 0px 0px 2px 2px #666666; -webkit-box-shadow: 2px 2px 5px 5x #666666; -moz-box-shadow: 2px 2px 5px 5px #666666; - padding: 10px; + padding: 5px; font-size: 12px; overflow: auto; max-height: 400px; diff --git a/packages/geoview-core/public/index.html b/packages/geoview-core/public/index.html index 2f792518d6e..d495a837c7d 100644 --- a/packages/geoview-core/public/index.html +++ b/packages/geoview-core/public/index.html @@ -29,7 +29,6 @@

Basic Loading

API loads - Type Of Layers

Custom Behaviour

Add Layers diff --git a/packages/geoview-core/public/templates/codedoc.js b/packages/geoview-core/public/templates/codedoc.js index 61f29925fce..8723d5d0f90 100644 --- a/packages/geoview-core/public/templates/codedoc.js +++ b/packages/geoview-core/public/templates/codedoc.js @@ -1,175 +1,190 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ -// Many functions name needs the eslint escape no-unused-vars. -// It is an utilities file for demo purpose. It is the reason why we keep it global... -function sleep(milliseconds) { - const date = Date.now(); - let currentDate = null; - do { - currentDate = Date.now(); - } while (currentDate - date < milliseconds); -} - -function createCodeSnippet() { - sleep(500); - - const scripts = Array.prototype.filter.call(document.getElementsByTagName('script'), (obj) => { - return obj.getAttribute('id') === null; - }); - - const script = scripts[scripts.length - 1]; - for (let i = 0, loop = true; loop; i++) { - const el = document.getElementById(`codeSnippet${i || ''}`); - if (el !== null) { - el.innerHTML = `
${script.textContent
-        .replace('//create snippets\n', '')
-        .replace('createConfigSnippet();\n', '')
-        .replace('createCodeSnippet();\n', '')}
`; - } else loop = false; - } -} - -function createCodeSnippetUsingIDs() { - sleep(500); - - // Enhanced code snippet generator which allows to associate a script id with a code snippet script (og function is using indexes) - // and write down different code snippet spreaded in the dom tree (og function always reuses 'script' variable which is the last script tag found in the dom) - // Get all scripts on page which has an id - const scripts = Array.prototype.filter.call(document.getElementsByTagName('script'), (obj) => { - return obj.getAttribute('id') !== null; - }); - - // Loop on each script - for (let i = 0; i < scripts.length; i++) { - // Try to find a codeSnippet flag interested in that script - const script = scripts[i]; - document.querySelectorAll(`[id-script="${script.id}"]`).forEach((el) => { - // eslint-disable-next-line no-param-reassign - el.innerHTML = `
${script.textContent}
`; - }); - } -} - -function createConfigSnippet() { - sleep(500); - - let j = 0; - // inject configuration snippet inside panel - for (j = 0; j < document.getElementsByClassName('geoview-map').length; j++) { - let configSnippet = ''; - const mapID = document.getElementsByClassName('geoview-map')[j].id; - configSnippet = document.getElementById(mapID).attributes['data-config']; - const el = document.getElementById(`${mapID}CS`); - - // check if JSON can be parsed, if not do nothing - try { - if (configSnippet !== undefined && el !== null) { - // Erase comments in the configSnippet. - const uncommentedConfigSnippet = configSnippet.value - .split(/(? { - if (index % 2) return fragment.replaceAll(/\/\*/gm, String.fromCharCode(1)).replaceAll(/\*\//gm, String.fromCharCode(2)); - return fragment; // .replaceAll(/\/\*(?<=\/\*)((?:.|\n|\r)*?)(?=\*\/)\*\//gm, ''); - }) - .join("'") - .replaceAll(/\/\*(?<=\/\*)((?:.|\n|\r)*?)(?=\*\/)\*\//gm, '') - .replaceAll(String.fromCharCode(1), '/*') - .replaceAll(String.fromCharCode(2), '*/'); - - el.textContent = JSON.stringify( - JSON.parse( - uncommentedConfigSnippet - // remove CR and LF from the map config - .replace(/(\r\n|\n|\r)/gm, '') - // replace apostrophes not preceded by a backslash with quotes - .replace(/(? { + return obj.getAttribute('id') === null; + }); + + const script = scripts[scripts.length - 1]; + for (let i = 0, loop = true; loop; i++) { + const el = document.getElementById(`codeSnippet${i || ''}`); + if (el !== null) { + el.innerHTML = `
${script.textContent
+        .replace('//create snippets\n', '')
+        .replace('createConfigSnippet();\n', '')
+        .replace('createCodeSnippet();\n', '')}
`; + } else loop = false; + } +} + +function createCodeSnippetUsingIDs() { + sleep(500); + + // Enhanced code snippet generator which allows to associate a script id with a code snippet script (og function is using indexes) + // and write down different code snippet spreaded in the dom tree (og function always reuses 'script' variable which is the last script tag found in the dom) + // Get all scripts on page which has an id + const scripts = Array.prototype.filter.call(document.getElementsByTagName('script'), (obj) => { + return obj.getAttribute('id') !== null; + }); + + // Loop on each script + for (let i = 0; i < scripts.length; i++) { + // Try to find a codeSnippet flag interested in that script + const script = scripts[i]; + document.querySelectorAll(`[id-script="${script.id}"]`).forEach((el) => { + // eslint-disable-next-line no-param-reassign + el.innerHTML = `
${script.textContent}
`; + }); + } +} + +function createConfigSnippet() { + sleep(500); + + let j = 0; + // inject configuration snippet inside panel + for (j = 0; j < document.getElementsByClassName('geoview-map').length; j++) { + let configSnippet = ''; + const mapID = document.getElementsByClassName('geoview-map')[j].id; + configSnippet = document.getElementById(mapID).attributes['data-config']; + const el = document.getElementById(`${mapID}CS`); + + // check if JSON can be parsed, if not do nothing + try { + if (configSnippet !== undefined && el !== null) { + // Erase comments in the configSnippet. + const uncommentedConfigSnippet = configSnippet.value + .split(/(? { + if (index % 2) return fragment.replaceAll(/\/\*/gm, String.fromCharCode(1)).replaceAll(/\*\//gm, String.fromCharCode(2)); + return fragment; // .replaceAll(/\/\*(?<=\/\*)((?:.|\n|\r)*?)(?=\*\/)\*\//gm, ''); + }) + .join("'") + .replaceAll(/\/\*(?<=\/\*)((?:.|\n|\r)*?)(?=\*\/)\*\//gm, '') + .replaceAll(String.fromCharCode(1), '/*') + .replaceAll(String.fromCharCode(2), '*/'); + + el.textContent = JSON.stringify( + JSON.parse( + uncommentedConfigSnippet + // remove CR and LF from the map config + .replace(/(\r\n|\n|\r)/gm, '') + // replace apostrophes not preceded by a backslash with quotes + .replace(/(? { + const { resultSet } = payload; + const outputHeader = ''; + const displayField = document.getElementById(elementId); + const output = Object.keys(resultSet).reduce((outputValue, layerPath) => { + const layerName = resultSet[layerPath]?.layerName || ''; + const { layerStatus } = resultSet[layerPath]; + return `${outputValue}`; + }, outputHeader); + displayField.innerHTML = output && output !== outputHeader ? `${output}
NameStatus
${layerName}${layerStatus}
` : ''; + }); +} diff --git a/packages/geoview-core/public/templates/demos-navigator.html b/packages/geoview-core/public/templates/demos-navigator.html index 7edefd049c1..45ff08ce426 100644 --- a/packages/geoview-core/public/templates/demos-navigator.html +++ b/packages/geoview-core/public/templates/demos-navigator.html @@ -147,7 +147,9 @@

Configurations Navigator

- + + + @@ -181,6 +183,9 @@

Configurations Navigator


+ +

+
     
@@ -222,7 +227,8 @@

Configurations Navigator

// wait until map is removed before recreating it setTimeout(() => { // create map - cgpv.api.createMapFromConfig('sandboxMap', e.target.value, 800); + cgpv.api.createMapFromConfig('sandboxMap', e.target.value, 800) + .then(() => listenToLegendLayerSetChanges('sandboxMap-state', 'sandboxMap')); }, 1500); // fetch JSON config file to show in the text are section diff --git a/packages/geoview-core/public/templates/demos/demo-cgdi.html b/packages/geoview-core/public/templates/demos/demo-cgdi.html index d1e9d101c95..2a2c4205d03 100644 --- a/packages/geoview-core/public/templates/demos/demo-cgdi.html +++ b/packages/geoview-core/public/templates/demos/demo-cgdi.html @@ -42,7 +42,7 @@

CGDI Water Resources Demo

Water Resources

- +

     
Water Resources >
- - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/packages/geoview-core/public/templates/layers/esri-dynamic.html b/packages/geoview-core/public/templates/layers/esri-dynamic.html deleted file mode 100644 index 997d035c80e..00000000000 --- a/packages/geoview-core/public/templates/layers/esri-dynamic.html +++ /dev/null @@ -1,721 +0,0 @@ - - - - - - - - ESRI Dynamic Layers - Canadian Geospatial Platform Viewer - - - - - - - - - - - -
- - - - - - - -
-

ESRI Dynamic Layers

-
- - - - - - - - - - - - - -
- Main
-     Type Of Layers
-
-

This page is used to showcase how the viewer may show ESRI Dynamic layer types

-
- 1. Many ESRI Dynamic Layers with legend settings in the config
- 2. Date filtering using time zone change and non ISO date format
- 3. Date filtering using ISO UTC dates
- -
-
- -
-

1. Many ESRI Dynamic Layers with legend settings in the config

- Top -
- -

-  
- -

-  
-  

-  
-  
Click on feature on the map
- -

-  
- -

-
-  
-

2. Date filtering using time zone changed and non ISO date format

- Top -
- -

-  
-

-  
-  

-  
-  
Click on feature on the map
- -

-  
- -

-
-  
-

3. Date filtering using ISO UTC dates

- Top -
- -

-  
-

-  
-  

-  
-  
Click on feature on the map
- -

-  
- -

-  
- -

-
-  
-  
-  
-
-
-
\ No newline at end of file
diff --git a/packages/geoview-core/public/templates/layers/esri-feature.html b/packages/geoview-core/public/templates/layers/esri-feature.html
deleted file mode 100644
index 067806e64b2..00000000000
--- a/packages/geoview-core/public/templates/layers/esri-feature.html
+++ /dev/null
@@ -1,388 +0,0 @@
-
-
-
-
-  
-  
-  
-    ESRI Feature Layers - Canadian Geospatial Platform Viewer
-  
-  
-  
-  
-  
-  
-  
-  
-
-
-
-  
- - - - - - - -
-

ESRI Feature Layers

-
- - - - - - - - - - - - - -
- Main
-     Type Of Layers
-
-

This page is used to showcase how the viewer may show ESRI Feature layer types

-
- 1. Many ESRI Feature Layers with legend settings from the metadata
- 2. Date filtering using time zone change and non ISO date format
- 3. Date filtering using ISO UTC dates
-
-
- -
-

1. Many Esri Feature Layers

- Top -
- -

-  
- -

-
-  
-  

-
-  
-  
Click on feature on the map
- - -
-    
-    
-
-
-

This map has a wms layer added from configuration.

- -

-
-  
-

2. Date filtering using time zone changed and non ISO date format

- Top -
- -

-  
-

-  
-  

-  
-  
Click on feature on the map
- -

-  
- -

-
-  
-

3. Date filtering using ISO UTC dates

- Top -
- -

-  
-

-  
-  

-  
-  
Click on feature on the map
- -

-  
- -

-  
- -

-
-  
-  
-  
-
-
-
\ No newline at end of file
diff --git a/packages/geoview-core/public/templates/layers/esri-image.html b/packages/geoview-core/public/templates/layers/esri-image.html
deleted file mode 100644
index 9d689bb100b..00000000000
--- a/packages/geoview-core/public/templates/layers/esri-image.html
+++ /dev/null
@@ -1,159 +0,0 @@
-
-
-
-
-  
-  
-  
-    ESRI Image Layers - Canadian Geospatial Platform Viewer
-  
-  
-  
-  
-  
-  
-  
-  
-
-
-
-  
- - - - - - - -
-

ESRI Image Layers

-
- - - - - - - - - - - - - -
- Main
-     Type Of Layers
-
-

This page is used to showcase how the viewer may show static image layer types

-
- 1. ESRI Image Layers
-
-
- -
-

1. ESRI Image Layers

- Top -
- -

-  
- -

-  
-  

-  

This map has a ESRI image layer added from configuration.

- -

-  
- -

-
-  
-  
-  
-
-
-
\ No newline at end of file
diff --git a/packages/geoview-core/public/templates/layers/geocore.html b/packages/geoview-core/public/templates/layers/geocore.html
deleted file mode 100644
index 4286eb4fc73..00000000000
--- a/packages/geoview-core/public/templates/layers/geocore.html
+++ /dev/null
@@ -1,197 +0,0 @@
-
-
-
-
-  
-  
-  
-    Geocore Layers - Canadian Geospatial Platform Viewer
-  
-  
-  
-  
-  
-  
-  
-  
-
-
-
-  
- - - - - - - -
-

Geocore Layers

-
- - - - - - - - - - - - - -
- Main
-     Type Of Layers
-
-

This page is used to showcase how the viewer may show Geocore layer types

-
- 1. Many Geocore Layers
- 2. Geocore Layers - with footer bar
-
-
- -
-

1. Many GeoCore Layers

- Top -
- -

-  
- -

-  
-  

-  
-  
Click on feature on the map
-
-

This map has a wms layer added from configuration.

- -

-  
- -

-
-  
-

2. GeoCore Layers - with footer bar

- Top -
- -

-  
- - - - - - - \ No newline at end of file diff --git a/packages/geoview-core/public/templates/layers/geojson.html b/packages/geoview-core/public/templates/layers/geojson.html deleted file mode 100644 index ca3f6b2b346..00000000000 --- a/packages/geoview-core/public/templates/layers/geojson.html +++ /dev/null @@ -1,243 +0,0 @@ - - - - - - - - GeoJson Layers - Canadian Geospatial Platform Viewer - - - - - - - - - - - -
- - - - - - - -
-

GeoJSON Layers

-
- - - - - - - - - - - - - -
- Main
-     Type Of Layers
-
-

This page is used to showcase how the viewer may show GeoJSON layer types

-
- 1. Many GeoJSON Layers
-
-
- -
-

1. Many GeoJSON Layers

- Top -
- -

-  
- -

-  
-  
-        
- -
- -
Click on feature on the map
- -

-  
- -

-  
- -

-
-  
-  
-  
-
-
-
\ No newline at end of file
diff --git a/packages/geoview-core/public/templates/layers/geopackage.html b/packages/geoview-core/public/templates/layers/geopackage.html
deleted file mode 100644
index 23451f16f00..00000000000
--- a/packages/geoview-core/public/templates/layers/geopackage.html
+++ /dev/null
@@ -1,248 +0,0 @@
-
-
-
-
-  
-  
-  
-    Geopackage Layers - Canadian Geospatial Platform Viewer
-  
-  
-  
-  
-  
-  
-  
-  
-
-
-
-  
- - - - - - - -
-

Geopackage Layers

-
- - - - - - - - - - - - - -
- Main
-     Type Of Layers
-
-

This page is used to showcase how the viewer may show Geopackage layer types

-
- 1. Geopackage Layers
- 2. Multiple GeoPackage Layers - one with multiple layers
- 3. Geopackage Layers - with footer bar
-
-
- -
-

1. GeoPackage Layers

- Top -
- -

-  
-
- -

-  
-  

-  
-  
Click on feature on the map
- -

-  
- -
-

2. Multiple GeoPackage Layers - one with multiple layers

- Top -
- -

-  
-
- -

-  
- -

-
-  
-

3. Geopackage Layers - with footer bar

- Top -
- -

-  
-
- - - - - - - \ No newline at end of file diff --git a/packages/geoview-core/public/templates/layers/image-static.html b/packages/geoview-core/public/templates/layers/image-static.html deleted file mode 100644 index 2e336335227..00000000000 --- a/packages/geoview-core/public/templates/layers/image-static.html +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - - - Static Image Layers - Canadian Geospatial Platform Viewer - - - - - - - - - - - -
- - - - - - - -
-

Static Image Layers

-
- - - - - - - - - - - - - -
- Main
-     Type Of Layers
-
-

This page is used to showcase how the viewer may show static image layer types

-
- 1. Static Image Layers
-
-
- -
-

1. Static Image Layers

- Top -
- -

-  
- -

-  
-  

-  

This map has a static image layer added from configuration.

- -

-  
- -

-
-  
-  
-  
-
-
-
\ No newline at end of file
diff --git a/packages/geoview-core/public/templates/layers/layerlib.js b/packages/geoview-core/public/templates/layers/layerlib.js
deleted file mode 100644
index d05cac49a1a..00000000000
--- a/packages/geoview-core/public/templates/layers/layerlib.js
+++ /dev/null
@@ -1,490 +0,0 @@
-// ==========================================================================================================================
-function listenToLegendLayerSetChanges(elementId, handlerName) {
-  const mapId = handlerName.split('/')[0];
-  cgpv.api.maps[mapId].layer.legendsLayerSet.onLayerSetUpdated((sender, payload) => {
-    const { resultSet } = payload;
-    const outputHeader = '';
-    const displayField = document.getElementById(elementId);
-    const output = Object.keys(resultSet).reduce((outputValue, layerPath) => {
-      const layerName = resultSet[layerPath]?.layerName || '';
-      const { layerStatus } = resultSet[layerPath];
-      return `${outputValue}`;
-    }, outputHeader);
-    displayField.innerHTML = output && output !== outputHeader ? `${output}
NameStatus
${layerName}${layerStatus}
` : ''; - }); -} - -// ========================================================================================================================== -const addBoundsPolygon = (mapId, bbox) => { - const newBbox = cgpv.api.utilities.projection.transformAndDensifyExtent( - bbox, - `EPSG:${cgpv.api.maps[mapId].getMapState().currentProjection}`, - `EPSG:4326` - ); - - const { geometry } = cgpv.api.maps[mapId].layer; - geometry.setActiveGeometryGroup(); - geometry.deleteGeometriesFromGroup(0); - - const polygon = cgpv.api.maps[mapId].layer.geometry.addPolygon([newBbox], { - style: { - strokeColor: '#000', - strokeWidth: 5, - strokeOpacity: 0.8, - }, - }); -}; - -// ========================================================================================================================== -const createInfoTable = (mapId, resultSetId, resultSet, eventType) => { - if (!['click', 'all-features'].includes(eventType)) return; - const infoTable = document.getElementById(`${resultSetId}-${eventType}`); - infoTable.textContent = ''; - const oldContent = document.getElementById(`layer${mapId.slice(-1)}-${eventType}-info`); - if (oldContent) oldContent.remove(); - const content = document.createElement('div'); - content.id = `layer${mapId.slice(-1)}-${eventType}-info`; - infoTable.appendChild(content); - Object.keys(resultSet).forEach((layerPath) => { - const activeResultSet = resultSet[layerPath]; - const layerData = activeResultSet.features; - - // Header of the layer - const infoH1 = document.createElement('h1'); - // eslint-disable-next-line no-nested-ternary - infoH1.innerText = !layerData ? `${layerPath} (error)` : layerData?.length ? layerPath : `${layerPath} (empty)`; - content.appendChild(infoH1); - - if (layerData?.length) { - let infoH2 = document.createElement('h2'); - infoH2.innerText = 'Aliases and types'; - content.appendChild(infoH2); - - // Header of the layer table that describe the aliases and the types - let tableElement = document.createElement('table'); - tableElement.classList.add('info'); - content.appendChild(tableElement); - - let tableRow = document.createElement('tr'); - tableRow.classList.add('info'); - tableElement.appendChild(tableRow); - let tableData = document.createElement('th'); - tableData.classList.add('infoCol1'); - tableRow.appendChild(tableData); - Object.keys(layerData[0].fieldInfo).forEach((fieldName) => { - tableData = document.createElement('th'); - tableData.classList.add('info'); - tableData.innerText = fieldName; - tableRow.appendChild(tableData); - }); - - // Row describing the aliases - tableRow = document.createElement('tr'); - tableRow.classList.add('info'); - tableElement.appendChild(tableRow); - tableData = document.createElement('td'); - tableData.classList.add('infoCol1'); - tableData.innerText = 'Aliases =>'; - tableRow.appendChild(tableData); - Object.keys(layerData[0].fieldInfo).forEach((fieldName) => { - tableData = document.createElement('td'); - tableData.classList.add('info'); - tableData.innerText = layerData[0].fieldInfo[fieldName].alias; - tableRow.appendChild(tableData); - }); - - // Row describing the types - tableRow = document.createElement('tr'); - tableRow.classList.add('infoCol1'); - tableElement.appendChild(tableRow); - tableData = document.createElement('td'); - tableData.classList.add('infoCol1'); - tableData.innerText = 'Types =>'; - tableRow.appendChild(tableData); - Object.keys(layerData[0].fieldInfo).forEach((fieldName) => { - tableData = document.createElement('td'); - tableData.classList.add('info'); - tableData.innerText = layerData[0].fieldInfo[fieldName].dataType; - tableRow.appendChild(tableData); - }); - - // Header of the data section - infoH2 = document.createElement('h2'); - infoH2.innerText = 'Data'; - content.appendChild(infoH2); - - tableElement = document.createElement('table'); - tableElement.classList.add('info'); - content.appendChild(tableElement); - let createHeaders = true; - - layerData.forEach((row) => { - // Header of the data table - if (createHeaders) { - tableRow = document.createElement('tr'); - tableRow.classList.add('info'); - tableElement.appendChild(tableRow); - - tableData = document.createElement('th'); - tableData.classList.add('infoCol1'); - tableData.innerText = 'Symbology'; - tableRow.appendChild(tableData); - - tableData = document.createElement('th'); - tableData.classList.add('infoCol1'); - tableData.innerText = 'Zoom To'; - tableRow.appendChild(tableData); - - Object.keys(row.fieldInfo).forEach((fieldName) => { - tableData = document.createElement('th'); - tableData.classList.add('info'); - tableData.innerText = fieldName; - tableRow.appendChild(tableData); - }); - createHeaders = false; - } - - // Data row (feature information) - tableRow = document.createElement('tr'); - tableRow.classList.add('info'); - tableElement.appendChild(tableRow); - - // Feature icon - tableData = document.createElement('td'); - tableData.classList.add('info'); - tableData.appendChild(row.featureIcon); - tableRow.appendChild(tableData); - - // Zoom to button - tableData = document.createElement('td'); - tableData.classList.add('info'); - tableRow.appendChild(tableData); - const tableZoomTo = document.createElement('button'); - tableZoomTo.innerText = 'Zoom To Feature'; - tableZoomTo.addEventListener('click', (e) => { - // eslint-disable-next-line no-undef - cgpv.api.maps[mapId].zoomToExtent(row.extent); - addBoundsPolygon(mapId, row.extent); - }); - tableData.appendChild(tableZoomTo); - - // feature fields - Object.keys(row.fieldInfo).forEach((fieldName) => { - tableData = document.createElement('td'); - tableData.classList.add('info'); - if (row.fieldInfo[fieldName].dataType === 'date') { - const { dateUtilities } = cgpv.api; - tableData.innerText = row.fieldInfo[fieldName].value; - } else tableData.innerText = row.fieldInfo[fieldName].value; - tableRow.appendChild(tableData); - }); - }); - } - content.appendChild(document.createElement('br')); - content.appendChild(document.createElement('hr')); - }); -}; - -// ========================================================================================================================== -const createTableOfFilter = (mapId) => { - let mapButtonsDiv = document.getElementById(`layer${mapId.slice(-1)}-buttons-pre`); - const oldTable = document.getElementById(`layer${mapId.slice(-1)}-buttons-table`); - if (oldTable) oldTable.remove(); - const tableElement = document.createElement('table'); - tableElement.id = `layer${mapId.slice(-1)}-buttons-table`; - tableElement.style.width = '100%'; - tableElement.border = '1px solid black'; - mapButtonsDiv.appendChild(tableElement); - let geoviewLayers = cgpv.api.maps?.[mapId]?.layer?.getGeoviewLayers(); - if (!geoviewLayers || geoviewLayers.length === 0) return; - geoviewLayers.forEach((geoviewLayer) => { - cgpv.api.maps[mapId].layer.getLayerEntryConfigIds().forEach((layerPath) => { - if (layerPath.startsWith(geoviewLayer.getGeoviewLayerId())) { - const layerConfig = cgpv.api.maps[mapId].layer.getLayerEntryConfig(layerPath); - cgpv.api.utilities.geo.getLegendStylesFromConfig(layerConfig.style).then((legendStyle) => { - mapButtonsDiv = document.createElement('td'); - // mapButtonsDiv.style.width = '16.66%'; - mapButtonsDiv.border = '1px solid black'; - tableElement.appendChild(mapButtonsDiv); - - const geoviewLayerH1 = document.createElement('h1'); - geoviewLayerH1.innerText = geoviewLayer.getGeoviewLayerName(); - mapButtonsDiv.appendChild(geoviewLayerH1); - - const layerConfigH2 = document.createElement('h2'); - layerConfigH2.innerText = `${layerConfig?.layerName}`; - layerConfigH2.style.height = '15px'; - mapButtonsDiv.appendChild(layerConfigH2); - - const toggleLayerVisibility = document.createElement('button'); - let visibilityFlag = geoviewLayer.getVisible(layerPath); - if (visibilityFlag) - toggleLayerVisibility.innerText = layerConfig?.source?.style === undefined ? 'Hide' : `Hide style ${layerConfig.source.style}`; - else - toggleLayerVisibility.innerText = layerConfig?.source?.style === undefined ? 'Show' : `Show style ${layerConfig.source.style}`; - toggleLayerVisibility.addEventListener('click', (e) => { - visibilityFlag = !geoviewLayer.getVisible(layerPath); - if (visibilityFlag) - toggleLayerVisibility.innerText = - layerConfig?.source?.style === undefined ? 'Hide' : `Hide style ${layerConfig.source.style}`; - else - toggleLayerVisibility.innerText = - layerConfig?.source?.style === undefined ? 'Show' : `Show style ${layerConfig.source.style}`; - geoviewLayer.setVisible(visibilityFlag, layerPath); - }); - layerConfigH2.appendChild(toggleLayerVisibility); - - if (layerConfig.style) { - Object.keys(layerConfig.style).forEach((geometry) => { - const geometryText = document.createElement('p'); - geometryText.innerText = `Geometry = ${geometry}`; - geometryText.style.height = '15px'; - mapButtonsDiv.appendChild(geometryText); - if (layerConfig.style[geometry].styleType === 'uniqueValue') { - if (layerConfig.style[geometry].defaultSettings) { - const toggleUniqueValueDefault = document.createElement('button'); - if (layerConfig.style[geometry].defaultVisible === true) - toggleUniqueValueDefault.innerText = `Hide ${layerConfig.style[geometry].defaultLabel}`; - else if (layerConfig.style[geometry].defaultVisible === false) - toggleUniqueValueDefault.innerText = `Show ${layerConfig.style[geometry].defaultLabel}`; - toggleUniqueValueDefault.addEventListener('click', (e) => { - if (layerConfig.style[geometry].defaultVisible === true) { - layerConfig.style[geometry].defaultVisible = false; - toggleUniqueValueDefault.innerText = `Show ${layerConfig.style[geometry].defaultLabel}`; - } else if (layerConfig.style[geometry].defaultVisible === false) { - layerConfig.style[geometry].defaultVisible = true; - toggleUniqueValueDefault.innerText = `Hide ${layerConfig.style[geometry].defaultLabel}`; - } - const checkbox = document.getElementById(`checkbox-${mapId}-${geoviewLayer.getGeoviewLayerId()}`); - const filterInput = document.getElementById(`filter-input-${mapId}-${geoviewLayer.getGeoviewLayerId()}`); - const filter = checkbox.value === 'true' ? filterInput.value : geoviewLayer.getLayerFilter(layerPath); - geoviewLayer.applyViewFilter(layerPath, filter, checkbox.value !== 'true'); - }); - mapButtonsDiv.appendChild(toggleUniqueValueDefault); - mapButtonsDiv.appendChild(legendStyle[geometry].defaultCanvas); - const br = document.createElement('br'); - br.style.height = '1px'; - mapButtonsDiv.appendChild(br); - } - for (let i = 0; i < layerConfig.style[geometry].uniqueValueStyleInfo.length; i++) { - const toggleUniqueValueFeature = document.createElement('button'); - if (layerConfig.style[geometry].uniqueValueStyleInfo[i].visible === true) - toggleUniqueValueFeature.innerText = `Hide ${layerConfig.style[geometry].uniqueValueStyleInfo[i].label}`; - else if (layerConfig.style[geometry].uniqueValueStyleInfo[i].visible === false) - toggleUniqueValueFeature.innerText = `Show ${layerConfig.style[geometry].uniqueValueStyleInfo[i].label}`; - toggleUniqueValueFeature.addEventListener('click', (e) => { - const uniqueValueStyleInfoEntry = layerConfig.style[geometry].uniqueValueStyleInfo[i]; - if (uniqueValueStyleInfoEntry.visible === true) { - uniqueValueStyleInfoEntry.visible = false; - toggleUniqueValueFeature.innerText = `Show ${uniqueValueStyleInfoEntry.label}`; - } else if (uniqueValueStyleInfoEntry.visible === false) { - uniqueValueStyleInfoEntry.visible = true; - toggleUniqueValueFeature.innerText = `Hide ${uniqueValueStyleInfoEntry.label}`; - } - const checkbox = document.getElementById(`checkbox-${mapId}-${geoviewLayer.getGeoviewLayerId()}`); - const filterInput = document.getElementById(`filter-input-${mapId}-${geoviewLayer.getGeoviewLayerId()}`); - const filter = checkbox.value === 'true' ? filterInput.value : geoviewLayer.getLayerFilter(layerPath); - geoviewLayer.applyViewFilter(layerPath, filter, checkbox.value !== 'true'); - }); - mapButtonsDiv.appendChild(toggleUniqueValueFeature); - mapButtonsDiv.appendChild(legendStyle[geometry].arrayOfCanvas[i]); - - const br = document.createElement('br'); - br.style.height = '1px'; - mapButtonsDiv.appendChild(br); - } - } else if (layerConfig.style[geometry].styleType === 'classBreaks') { - if (layerConfig.style[geometry].defaultSettings) { - const toggleClassBreakDefault = document.createElement('button'); - if (layerConfig.style[geometry].defaultVisible === true) - toggleClassBreakDefault.innerText = `Hide ${layerConfig.style[geometry].defaultLabel}`; - else if (layerConfig.style[geometry].defaultVisible === false) - toggleClassBreakDefault.innerText = `Show ${layerConfig.style[geometry].defaultLabel}`; - toggleClassBreakDefault.addEventListener('click', (e) => { - if (layerConfig.style[geometry].defaultVisible === true) { - layerConfig.style[geometry].defaultVisible = false; - toggleClassBreakDefault.innerText = `Show ${layerConfig.style[geometry].defaultLabel}`; - } else if (layerConfig.style[geometry].defaultVisible === false) { - layerConfig.style[geometry].defaultVisible = true; - toggleClassBreakDefault.innerText = `Hide ${layerConfig.style[geometry].defaultLabel}`; - } - const checkbox = document.getElementById(`checkbox-${mapId}-${geoviewLayer.getGeoviewLayerId()}`); - const filterInput = document.getElementById(`filter-input-${mapId}-${geoviewLayer.getGeoviewLayerId()}`); - const filter = checkbox.value === 'true' ? filterInput.value : geoviewLayer.getLayerFilter(layerPath); - geoviewLayer.applyViewFilter(layerPath, filter, checkbox.value !== 'true'); - }); - mapButtonsDiv.appendChild(toggleClassBreakDefault); - const br = document.createElement('br'); - br.style.height = '1px'; - mapButtonsDiv.appendChild(br); - } - for (let i = 0; i < layerConfig.style[geometry].classBreakStyleInfo.length; i++) { - const toggleClassBreakFeature = document.createElement('button'); - if (layerConfig.style[geometry].classBreakStyleInfo[i].visible === true) - toggleClassBreakFeature.innerText = `Hide ${layerConfig.style[geometry].classBreakStyleInfo[i].label}`; - else if (layerConfig.style[geometry].classBreakStyleInfo[i].visible === false) - toggleClassBreakFeature.innerText = `Show ${layerConfig.style[geometry].classBreakStyleInfo[i].label}`; - toggleClassBreakFeature.addEventListener('click', (e) => { - const classBreakStyleInfoEntry = layerConfig.style[geometry].classBreakStyleInfo[i]; - if (classBreakStyleInfoEntry.visible === true) { - classBreakStyleInfoEntry.visible = false; - toggleClassBreakFeature.innerText = `Show ${classBreakStyleInfoEntry.label}`; - } else if (classBreakStyleInfoEntry.visible === false) { - classBreakStyleInfoEntry.visible = true; - toggleClassBreakFeature.innerText = `Hide ${classBreakStyleInfoEntry.label}`; - } - const checkbox = document.getElementById(`checkbox-${mapId}-${geoviewLayer.getGeoviewLayerId()}`); - const filterInput = document.getElementById(`filter-input-${mapId}-${geoviewLayer.getGeoviewLayerId()}`); - const filter = checkbox.value === 'true' ? filterInput.value : geoviewLayer.getLayerFilter(layerPath); - geoviewLayer.applyViewFilter(layerPath, filter, checkbox.value !== 'true'); - }); - mapButtonsDiv.appendChild(toggleClassBreakFeature); - mapButtonsDiv.appendChild(legendStyle[geometry].arrayOfCanvas[i]); - - const br = document.createElement('br'); - br.style.height = '1px'; - mapButtonsDiv.appendChild(br); - } - } - const layerFilterText = document.createElement('p'); - layerFilterText.innerText = `Extra filter: `; - mapButtonsDiv.appendChild(layerFilterText); - const layerFilterInput = document.createElement('input'); - layerFilterInput.id = `filter-input-${mapId}-${geoviewLayer.getGeoviewLayerId()}`; - layerFilterInput.style.width = '50%'; - layerFilterText.appendChild(layerFilterInput); - layerFilterInput.value = geoviewLayer.getLayerFilter(layerPath) || ''; - const layerFilterButton = document.createElement('button'); - layerFilterButton.addEventListener('click', (e) => { - const checkbox = document.getElementById(`checkbox-${mapId}-${geoviewLayer.getGeoviewLayerId()}`); - geoviewLayer.applyViewFilter(layerPath, layerFilterInput.value, checkbox.value !== 'true'); - }); - layerFilterButton.innerText = 'Apply'; - layerFilterText.style.width = 'max-content'; - layerFilterText.appendChild(layerFilterButton); - - const checkboxInput = document.createElement('input'); - checkboxInput.type = 'checkbox'; - checkboxInput.value = 'false'; - checkboxInput.id = `checkbox-${mapId}-${geoviewLayer.getGeoviewLayerId()}`; - checkboxInput.addEventListener('click', (e) => { - checkboxInput.value = checkboxInput.value === 'true' ? 'false' : 'true'; - geoviewLayer.applyViewFilter(layerPath, layerFilterInput.value, checkboxInput.value !== 'true'); - }); - mapButtonsDiv.appendChild(checkboxInput); - const checkboxText = document.createElement('label'); - checkboxText.innerText = `apply only the extra filter`; - mapButtonsDiv.appendChild(checkboxText); - }); - } - }); - } - }); - }); -}; - -// ========================================================================================================================== -function displayLegend(layerSetId, resultSet) { - const addHeader = (title, container) => { - const tableHeader = document.createElement('th'); - tableHeader.style = 'text-align: center; vertical-align: middle;'; - tableHeader.innerHTML = title; - container.appendChild(tableHeader); - }; - const addData = (data, container) => { - const tableData = document.createElement('td'); - tableData.style.verticalAlign = 'middle'; - tableData.style.textAlign = 'center'; - if (data) - if (typeof data === 'string') tableData.innerHTML = data.replaceAll('<', '<').replaceAll('>', '>'); - else tableData.appendChild(data); - else tableData.innerHTML = 'NO LEGEND'; - container.appendChild(tableData); - }; - const oldTable = document.getElementById(`${layerSetId}-table`); - if (oldTable) oldTable.parentNode.removeChild(oldTable); - const legendTable = document.getElementById(`${layerSetId}-table-pre`); - const table = document.createElement('table'); - table.id = `${layerSetId}-table`; - table.border = '1'; - table.style = 'width:50%'; - legendTable.appendChild(table); - let createHeader = true; - Object.keys(resultSet).forEach((layerPath) => { - const activeResultSet = resultSet[layerPath]; - if (createHeader) { - createHeader = false; - const tableRow1 = document.createElement('tr'); - table.appendChild(tableRow1); - addHeader('Layer Path', tableRow1); - addHeader('Status/Label', tableRow1); - addHeader('Symbology', tableRow1); - } - if (!activeResultSet?.data?.legend) { - const tableRow = document.createElement('tr'); - addData(layerPath, tableRow); - let legendValue = ''; - if (activeResultSet.data === undefined) legendValue = '(waiting for legend)'; - if (activeResultSet.data === null) legendValue = '(legend fetch error)'; - if (activeResultSet.data && !activeResultSet.data.legend && activeResultSet.layerStatus === 'loaded') legendValue = '(no legend)'; - addData(activeResultSet.layerStatus, tableRow); - addData(legendValue, tableRow); - table.appendChild(tableRow); - } else if (activeResultSet.data?.type === 'ogcWms' || activeResultSet.data?.type === 'imageStatic') { - const tableRow = document.createElement('tr'); - addData(activeResultSet.data.layerPath, tableRow); - addData(activeResultSet.layerStatus, tableRow); - addData(activeResultSet.data.legend, tableRow); - table.appendChild(tableRow); - } else { - const addRow = (layerPathToUse, label, canvas) => { - const tableRow = document.createElement('tr'); - addData(layerPathToUse, tableRow); - addData(label, tableRow); // canvas.style = "border: 1px solid black;" - addData(canvas, tableRow); - table.appendChild(tableRow); - }; - if (activeResultSet.data?.legend) { - Object.keys(activeResultSet.data.legend).forEach((geometryKey) => { - if (geometryKey) { - if (activeResultSet.data.styleConfig[geometryKey].styleType === 'uniqueValue') { - if (activeResultSet.data.legend[geometryKey].defaultCanvas) - addRow( - layerPath, - activeResultSet.data.styleConfig[geometryKey].defaultLabel, - activeResultSet.data.legend[geometryKey].defaultCanvas - ); - for (let i = 0; i < activeResultSet.data.legend[geometryKey].arrayOfCanvas.length; i++) { - addRow( - layerPath, - activeResultSet.data.styleConfig[geometryKey].uniqueValueStyleInfo[i].label, - activeResultSet.data.legend[geometryKey].arrayOfCanvas[i] - ); - } - } else if (activeResultSet.data.styleConfig[geometryKey].styleType === 'classBreaks') { - if (activeResultSet.data.legend[geometryKey].defaultCanvas) - addRow( - layerPath, - activeResultSet.data.styleConfig[geometryKey].defaultLabel, - activeResultSet.data.legend[geometryKey].defaultCanvas - ); - for (let i = 0; i < activeResultSet.data.legend[geometryKey].arrayOfCanvas.length; i++) { - addRow( - layerPath, - activeResultSet.data.styleConfig[geometryKey].classBreakStyleInfo[i].label, - activeResultSet.data.legend[geometryKey].arrayOfCanvas[i] - ); - } - } else if (activeResultSet.data.styleConfig[geometryKey].styleType === 'simple') { - addRow( - layerPath, - activeResultSet.data.styleConfig[geometryKey].label, - activeResultSet.data.legend[geometryKey].defaultCanvas - ); - } - } - }); - } - } - }); -} diff --git a/packages/geoview-core/public/templates/layers/ogc-feature.html b/packages/geoview-core/public/templates/layers/ogc-feature.html deleted file mode 100644 index 3fbf7ace9fa..00000000000 --- a/packages/geoview-core/public/templates/layers/ogc-feature.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - OGC Feature API Layers - Canadian Geospatial Platform Viewer - - - - - - - - - - - -
- - - - - - - -
-

OGC Feature API Layers

-
- - - - - - - - - - - - - -
- Main
-     Type Of Layers
-
-

This page is used to showcase how the viewer may show OGC Feature layer types

-
- 1. OGC Feature Layers
-
-
- -
-

1. OGC Feature API Layers

- Top -
- -

-  
- -

-  
-  

-  
-  
Click on feature on the map
- -

-  
-

This map has a wms layer added from configuration.

- -

-  
- -

-
-  
-  
-  
-
-
-
\ No newline at end of file
diff --git a/packages/geoview-core/public/templates/layers/type-of-layers.html b/packages/geoview-core/public/templates/layers/type-of-layers.html
deleted file mode 100644
index 80cd96b8a38..00000000000
--- a/packages/geoview-core/public/templates/layers/type-of-layers.html
+++ /dev/null
@@ -1,63 +0,0 @@
-
-
-
-
-  
-  
-  
-    Type Of Layers - Canadian Geospatial Platform Viewer
-  
-  
-  
-  
-  
-  
-  
-  
-
-
-
-  
- - - - - - - -
-

Type Of Layers

-
- - - - - - - - - - - - -
Main
-

This page is used to showcase how the viewer may show different layer types.

-
-     1. WMS Layer
-     2. XYZ Tiles Layer
-     3. Esri Dynamic Service Layer
-     4. Esri Feature Service Layer
-     5. Esri Image Layer
-     6. GeoJSON Layer
-     7. WFS Layer
-     8. OGC Feature API Layer
-     9. GeoCore UUID Layer - NEED TO MOVE OUTSIDE -
-     10. GeoPackage Layer - NEED TO MOVE OUTSIDE -
-     11. Static Image Layer
-     12. Vector Tiles Layer
-     13. CSV Layer -
-
- - - \ No newline at end of file diff --git a/packages/geoview-core/public/templates/layers/vector-tiles.html b/packages/geoview-core/public/templates/layers/vector-tiles.html deleted file mode 100644 index ac642f1c14f..00000000000 --- a/packages/geoview-core/public/templates/layers/vector-tiles.html +++ /dev/null @@ -1,158 +0,0 @@ - - - - - - - - Vector Tile Layers - Canadian Geospatial Platform Viewer - - - - - - - - - - - -
- - - - - - - -
-

Vector Tile Layers

-
- - - - - - - - - - - - - -
- Main
-     Type Of Layers
-
-

This page is used to showcase how the viewer may show Vector Tiles layer types

-
- 1. Vector Tiles Layers (declutter)
- 2. Vector Tiles Layers (no declutter)
-
-
- -
-

1. Vector Tiles Layers (declutter)

- Top -
- -

-  
-

This map has a Vector Tiles layer added from configuration. Declutter is set to true for this vector tile layer. -

- -

-  
- -
-

2. Vector Tiles Layers (no declutter)

- Top -
- -

-  
-

This map has a Vector Tiles layer added from configuration. Declutter is set to false for this vector tile layer. -

-

-  
- - - - - - - \ No newline at end of file diff --git a/packages/geoview-core/public/templates/layers/wfs.html b/packages/geoview-core/public/templates/layers/wfs.html deleted file mode 100644 index e1db0bc80ef..00000000000 --- a/packages/geoview-core/public/templates/layers/wfs.html +++ /dev/null @@ -1,230 +0,0 @@ - - - - - - - - WFS Layers - Canadian Geospatial Platform Viewer - - - - - - - - - - - -
- - - - - - - -
-

WFS Layers

-
- - - - - - - - - - - - - -
- Main
-     Type Of Layers
-
-

This page is used to showcase how the viewer may show WFS layer types

-
- 1. WFS Layers
- 2. WFS Layers using bbox strategy
-
-
- -
-

1. WFS Layers

- Top -
- -

-  
- -

-  
-  

-  
-  
Click on feature on the map
- -

-  
-

This map has a wfs layer added from configuration.

- -

-
-  
-

2. WFS Layers using bbox strategy

- Top -
- -

-  
- -

-  
-  

-  
-  
Click on feature on the map
- -

-  
-

This map has a wfs layer added from configuration.

- -

-  
- -

-
-  
-  
-  
-
-
-
\ No newline at end of file
diff --git a/packages/geoview-core/public/templates/layers/wms.html b/packages/geoview-core/public/templates/layers/wms.html
deleted file mode 100644
index 82c786faf61..00000000000
--- a/packages/geoview-core/public/templates/layers/wms.html
+++ /dev/null
@@ -1,622 +0,0 @@
-
-
-  
-    
-    
-    WMS Layers - Canadian Geospatial Platform Viewer
-    
-    
-    
-    
-    
-    
-    
-  
-
-  
-    
- - - - - - - -
-

WMS Layers

-
- - - - - - - - - - - - -
- Main
-     Type Of Layers
-
-

This page is used to showcase how the viewer may show WMS layer types

-
- 1. Many WMS Layers
- 2. All Styles of a WMS Layer
- 3. Choose from a list of styles
- 4. Automatic group creation from metadata information
-
-
- -
-

1. Many WMS Layers (the map displays the different phases of the temporal dimension)

- Top -
- -

-    
-    
- -

-    
-    

-    
-    
Click on feature on the map
-
-

This map has a wms layer added from configuration.

- -

-
-    
-

2. All Styles of a WMS Layer

- Top -
- -

-    
- -

-    
-    

-    
-    
Click on feature on the map
-
-

This map has a wms layer added from configuration.

- -

-    
- -
-

3. All Styles of a WMS Layer

- Top -
- -

-    
- - - -

-    
-    
Click on feature on the map
-
-

This map has a wms layer added from configuration.

- -

-    
- -
-

4. Automatic group creation from metadata information (NOT WORKING)

-

Use a child layer for the moment

- Top -
- -

-    
- -

-    
-    

-    
-

This map has a wms layer added from configuration.

- -

-    
- -

-
-    
-    
-    
-  
-
diff --git a/packages/geoview-core/public/templates/layers/xyz.html b/packages/geoview-core/public/templates/layers/xyz.html
deleted file mode 100644
index 51dba031fb0..00000000000
--- a/packages/geoview-core/public/templates/layers/xyz.html
+++ /dev/null
@@ -1,115 +0,0 @@
-
-
-
-
-  
-  
-  
-    XYZ Layers- Canadian Geospatial Platform Viewer
-  
-  
-  
-  
-  
-  
-  
-  
-
-
-
-  
- - - - - - - -
-

XYZ Layers

-
- - - - - - - - - - - - - -
- Main
-     Type Of Layers
-
-

This page is used to showcase how the viewer may show XYZ layer types

-
- 1. XYZ Layers
-
-
- -
-

1. XYZ Tiles Layers

- Top -
- -

-  
-

This map has a XYZ Tiles layer added from configuration.

- -

-  
- -

-
-  
-  
-  
-
-
-
\ No newline at end of file
diff --git a/packages/geoview-core/public/templates/outliers/outlier-ESRI-maxRecordCount.html b/packages/geoview-core/public/templates/outliers/outlier-ESRI-maxRecordCount.html
index 7c1593daa2b..3ef9788509f 100644
--- a/packages/geoview-core/public/templates/outliers/outlier-ESRI-maxRecordCount.html
+++ b/packages/geoview-core/public/templates/outliers/outlier-ESRI-maxRecordCount.html
@@ -47,7 +47,7 @@ 

Outlier layers with max record count

Max Record Count Layers

Top - +

     
Max Record Count Layers
- - - - - - - - \ No newline at end of file diff --git a/packages/geoview-core/public/templates/sandbox.html b/packages/geoview-core/public/templates/sandbox.html index ff90303917c..f0329caa05a 100644 --- a/packages/geoview-core/public/templates/sandbox.html +++ b/packages/geoview-core/public/templates/sandbox.html @@ -172,6 +172,8 @@

Sandbox

Sanbox Map

Top
+ +

     
@@ -182,7 +184,6 @@

Sanbox Map


 
     
-
     
-  
-  
-
-
-
\ No newline at end of file
diff --git a/packages/geoview-core/webpack.common.js b/packages/geoview-core/webpack.common.js
index 5fa51e37a2f..e2e7e9cf44d 100644
--- a/packages/geoview-core/webpack.common.js
+++ b/packages/geoview-core/webpack.common.js
@@ -30,18 +30,6 @@ const multipleHtmlPluginsSamples = glob.sync('./public/templates/*.html').map((n
   });
 });
 
-// inject all layer files
-const multipleHtmlPluginsLayers = glob.sync('./public/templates/layers/*.html').map((name) => {
-  return new HtmlWebpackPlugin({
-    template: `${name}`,
-    filename: `${name.substring(name.lastIndexOf('/') + 1, name.length)}`,
-    title: 'Canadian Geospatial Platform Viewer',
-    inject: 'head',
-    scriptLoading: 'blocking',
-    chunks: ['cgpv-main'],
-  });
-});
-
 // inject all demos files
 const multipleHtmlPluginsDemos = glob.sync('./public/templates/demos/*.html').map((name) => {
   return new HtmlWebpackPlugin({
@@ -183,7 +171,6 @@ const config = {
         { from: './public/plugins', to: 'plugins', noErrorOnMissing: true },
         { from: './public/favicon.ico' },
         { from: './public/templates/codedoc.js' },
-        { from: './public/templates/layers/layerlib.js' },
       ],
     }),
     new webpack.BannerPlugin({
@@ -202,7 +189,6 @@ const config = {
     }),
   ]
     .concat(multipleHtmlPluginsSamples)
-    .concat(multipleHtmlPluginsLayers)
     .concat(multipleHtmlPluginsDemos)
     .concat(multipleHtmlPluginsOutliers),
 };