NCEAS / metacatui

MetacatUI: A client-side web interface for DataONE data repositories
https://nceas.github.io/metacatui
Apache License 2.0
42 stars 28 forks source link

Support nested data layers #1773

Closed laurenwalker closed 7 months ago

laurenwalker commented 3 years ago

e.g. the ice wedge polygon layer may want to have nested layers of high-center and low-center wedges. These might be different Cesium layers or just shortcuts for filtering the parent layer based on an attribute.

robyngit commented 2 years ago

This feature was requested by Mike Brubaker and Mike Brook for the LEO Network layer. In particular, they would like to see sub-layers that categorize posts by topic.

robyngit commented 2 years ago

Relevant parts of the original mockups for this feature: group_layers

robyngit commented 1 year ago

The DRP portal has enough layers that this feature is really needed for usability. The PDG portal is getting close to that point as well.

robyngit commented 1 year ago

A good place to start with this issue would be to decide how a portal can configure nested layers, and what sorts of options should be configurable (e.g. icon, label)

iannesbitt commented 1 year ago

Here's a first shot at describing it based on how I imagine it in my head.

Config implementation:

  {
    "type": "group",
    "label": "Weather",
    "icon": "icon-location.svg",
    "description": "Current weather conditions from NOAA nowCOAST",
    "layers":
      {
        "type": "WebMapServiceImageryProvider",
        "label": "Wind Speed",
        "description": "This nowCOAST time-enabled map service provides...",
        "visible": false,
        "opacity": 0.7,
        "cesiumOptions": {
          "url": "https://nowcoast.noaa.gov/geoserver/forecasts/ndfd_wind/ows?SERVICE=WMS&",
          "layers": "alaska_wind_speed",
          "parameters": {
            "transparent": "true",
            "format": "image/png"
          }
        },
        "attribution": "NWS National Digital Forecast Database (NDFD)",
        "moreInfoLink": "https://nowcoast.noaa.gov/"
      },
      {
        "type": "WebMapServiceImageryProvider",
        "label": "Another layer",
        ...
      }
  },
  {
    "type": "group",
    "label": "Another group",
    ...
  },
  {
    "type": "GeoJSONDataLayer",
    "label": "A third layer, this time outside any group",
    ...
  }

Configurable:

UI functionality (in suggested order of importance):

robyngit commented 1 year ago

This is excellent @iannesbitt thank you! An idea (maybe for a future enhancement): Could the nested layers inherit properties from their parent "group"? For example, if a group included a "citation", any child layer without a "citation" property would automatically use the citation text from the group its in. I imagine there might be a lot of duplicated properties within a layer group; this way the property only needs to be configured once. This could make things a lot more complicated though.

iannesbitt commented 1 year ago

I was thinking about this yesterday too. It could be really useful to have the group settings apply to all child layers, and the child settings be able to override the group ones. That would also have the effect of cutting down on a little bit of config document length as well.

yvonnesjy commented 9 months ago

I'll start looking into this

Mocks: https://docs.google.com/presentation/d/1xBSUGLq6fPV4RukzFMYqVszUMISeLpvgqTNRcQHaOLg/edit?resourcekey=0-SfzZXnxAwtnOTg1KSPvLqg#slide=id.SLIDES_API767222691_0

yvonnesjy commented 9 months ago

Because other portals (ex. DRP) also use layers, we probably need to make sure the solution is compatible with the current xml config structure. So the UI should be able to support both { layers: [...] } and { layerCategories: [ { ... layers: {} } ] }, but NOT both. Correct?

robyngit commented 9 months ago

@yvonnesjy, yes, other portals use the Cesium map, and all Cesium maps in MetacatUI use the same configuration options to customize the map to suit the portal. So the solution needs to be flexible, such that each portal can choose their own categories to group layers by, or can even choose to not group layers at all.

We also don't want to make changes that aren't backwards compatible with the current map config options. In other words, existing portals that use Cesium (like the DRP) shouldn't break with the changes we make. If we were to rename am existing property, for example, that would cause all sorts of problems for other portals. So yes, if we were to add a new layerCategories property, MetacatUI would need to also still support the layers property.

The goal is to ADD the minimum required config options needed to inform MetacatUI how it should group layers together (and what that group should be called, and maybe what icon to use for it...)

In case you haven't seen the following yet, here are pointers to a few related resources:

* It's not very typical to nest JSON (map config) within XML (portal config), and it's difficult to read that way, so for your reference, here is the JSON map config extracted from the PDG portal document:

Click to expand to view PDG map config ```json { "homePosition": { "heading": 356, "height": 15375560, "latitude": 84.23277, "longitude": -106.79526, "pitch": -89.83940540045835, "roll": 0 }, "layers": [ { "label": "Ice-Wedge Polygons", "icon": "urn:uuid:73f234f7-a2ae-46b4-9bc2-8d75f69b25a8", "type": "WebMapTileServiceImageryProvider", "visible": true, "description": "Ice-wedge polygons are ubiquitous ground features in landscapes underlain by ice-rich permafrost. Ice-wedge polygons are bounded by wedges of ice, which develop from millenia of repeated frost-cracking during cold winters and snowmelt water infiltrating into the cracks in spring. High resolution satellite imagery combined with deep learning tools were used to detect ice-wedge polygons across the Arctic tundra. To learn more about how this data was produced, see this publication: https://arcticdata.io/catalog/view/doi:10.18739/A2KW57K57", "attribution": "Chandi Witharana, Mahendra R Udawalpola, Amal S Perera, Amit Hasan, Elias Manos, Anna Liljedahl, Mikhail Kanevskiy, M Torre Jorgenson, Ronald Daanen, Benjamin Jones, Howard Epstein, Matthew B Jones, Robyn Thiessen-bock, Juliet Cohen, & Kastan Day. (2023). Ice-wedge polygon detection in satellite imagery from pan-Arctic regions, Permafrost Discovery Gateway, 2001-2021. Arctic Data Center. doi:10.18739/A2KW57K57.", "cesiumOptions": { "url": "https://arcticdata.io/data/tiles/10.18739/A2KW57K57/WGS1984Quad/{TileMatrix}/{TileCol}/{TileRow}.png", "tilingScheme": "GeographicTilingScheme", "rectangle": [ -179.91531896747117, 50.16996707215903, 179.91531896747247, 80.0978646943821 ] }, "colorPalette": { "paletteType": "continuous", "property": "Percent area covered by polygons", "colors": [{ "color": "#f8ff1f" }] } }, { "label": "Permafrost Tunnel Tour", "type": "GeoJsonDataSource", "visible": false, "description": "A virtual tour of the Permafrost Tunnel that is located just north of Fairbanks, Alaska, and managed by the Cold Region Research and Engineering Laboratory (CRREL). Access the tour by navigating to the Full Details link below.", "moreInfoLink": "https://virtualice.byrd.osu.edu/permafrost/", "attribution": "J. Cervenec and J. Moss (2022): Permafrost Tunnel Tour", "icon": "", "notification": { "style": "blue" }, "colorPalette": { "colors": [{ "color": "#d1134c" }] }, "featureTemplate": { "template": "story", "label": "label", "options": { "description": "description", "thumbnail": "thumbnail", "url": "url", "urlText": "urlText" } }, "cesiumOptions": { "data": { "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry": { "type": "Point", "coordinates": [-147.6209142699301, 64.951365829418] }, "properties": { "label": "Permafrost Research Tunnel", "description": "Take a virtual tour through the CRREL Permafrost Tunnel Research Facility in Fairbanks, Alaska", "thumbnail": "https://media.defense.gov/2012/Dec/27/2000725210/-1/-1/0/120720-A-HB029-008.JPG", "url": "https://virtualice.byrd.osu.edu/permafrost/", "urlText": "Tour the Tunnel" } } ] } } }, { "label": "Local News Stories", "type": "GeoJsonDataSource", "visible": false, "description": "Read the latest stories

The Local Environmental Observer (LEO) Network is a group of local observers and topic experts who share knowledge about unusual animal, environment, and weather events. This LEO Map is a collection of posts about time and location specific events related to permafrost. It is a living map, which means it is updated with new content from local observations or newspapers, as they are published into LEO Network.", "moreInfoLink": "https://www.leonetwork.org/en/explore/posts?query=&mode=list&infotype=EVENT®ion=&polygon=&bbox=&minlat=&maxlat=&near=&radius=&categories=PERMAFROST%7cPermafrost+Change&categories_anyOrAll=ALL&fromdate=&todate=", "downloadLink": "https://www.leonetwork.org/explore/posts?query=&type=TWEET&type=POST&type=ARTICLE&mode=geojson_compact®ion=&polygon=&bbox=&minlat=&maxlat=&near=&radius=&categories=PERMAFROST%7cPermafrost+Change&categories_anyOrAll=ANY&fromdate=&todate=", "attribution": "M. Brubaker; M. Brook; J. Temte. (2021): Permafrost Discovery Gateway (PDG). LEO Network.", "icon": "", "opacity": 0.8, "colorPalette": { "property": "year", "colors": [ { "value": "2010", "color": "#8e58d8" }, { "value": "2011", "color": "#8e67db" }, { "value": "2012", "color": "#8d75de" }, { "value": "2013", "color": "#8c82e1" }, { "value": "2014", "color": "#8b8fe4" }, { "value": "2015", "color": "#899ce7" }, { "value": "2016", "color": "#88a8e9" }, { "value": "2017", "color": "#87b4eb" }, { "value": "2018", "color": "#87c0ec" }, { "value": "2019", "color": "#89cbed" }, { "value": "2020", "color": "#8dd7ee" }, { "value": "2021", "color": "#96e1ec" }, { "value": "2022", "color": "#c9e4de" } ] }, "customProperties": { "formattedDate": { "property": "date", "type": "date", "format": "YYYY MMM DD" }, "year": { "property": "date", "type": "date", "format": "YYYY" }, "urlText": { "type": "string", "value": "Read more on LEO Network " } }, "featureTemplate": { "template": "story", "label": "title", "options": { "subtitle": "formattedDate", "description": "description", "thumbnail": "thumbnail", "url": "url", "urlText": "urlText" } }, "cesiumOptions": { "data": "https://www.leonetwork.org/en/explore/posts?query=&type=TWEET&type=POST&type=ARTICLE&mode=geojson_compact®ion=&polygon=&bbox=&minlat=&maxlat=&near=&radius=&categories=PERMAFROST%7cPermafrost+Change&categories_anyOrAll=ANY&fromdate=&todate=" } }, { "label": "Communities", "type": "GeoJsonDataSource", "visible": false, "description": "Contains a list of Arctic communities suitable for providing context in other geospatial data visualizations. Dataset is limited to communities >= 55 degrees north latitude, with populations >= 10,000 as of 2022, except for Alaska communities which allow populations down to 500. The intent of this dataset is to provide intuitive landmarks that help with interpretation of other geospatial datasets. This dataset contains minimal fields: community name, 2-letter country abbreviation, latitude/longitude, estimated population as of 2022, and Geonames identifier.", "moreInfoLink": "https://arcticdata.io/catalog/view/doi%3A10.18739%2FA28S4JQ80", "downloadLink": "https://arcticdata.io/catalog/view/doi%3A10.18739%2FA28S4JQ80#urn%3Auuid%3Aed7718ae-fb0d-43dd-9270-fbfe80bfc7a4", "attribution": "Local Environmental Observer (LEO) Network", "icon": "", "notification": { "style": "blue" }, "opacity": 0.8, "colorPalette": { "paletteType": "continuous", "property": "population", "colors": [ { "color": "#91ff8f", "value": 501 }, { "color": "#014200", "value": 76000 }, { "color": "#013300", "value": 10381221 } ] }, "customProperties": { "populationWord": { "property": "date", "type": "string", "value": "Population" } }, "featureTemplate": { "template": "story", "label": "name", "options": { "subtitle": "populationWord", "description": "population" } }, "cesiumOptions": { "data": "https://arcticdata.io/metacat/d1/mn/v2/object/urn%3Auuid%3Aed7718ae-fb0d-43dd-9270-fbfe80bfc7a4" } }, { "type": "WebMapTileServiceImageryProvider", "label": "Drained Lake Basins, North Slope, 2014-2019", "description": "This data set contains a classification of the North Slope, Alaska for drained lake basins (DLBs) based on Landsat-8 imagery of the years 2014-2019, and covers greater than 71,000 km2. Areas classified as ambiguous could not be classified as DLB or noDLB with sufficient certainty. It is based on a novel and scalable remote sensing-based approach to identify DLBs in lowland permafrost regions.", "attribution": "Helena Bergstedt, Benjamin Jones, Kenneth Hinkel, Louise Farquharson, Benjamin Gaglioti, et al. 2021. Drained Lake Basin classification based on Landsat-8 imagery, North Slope, Alaska 2014 -2019. Arctic Data Center. doi:10.18739/A2K35MF71.", "moreInfoLink": "https://arcticdata.io/catalog/view/doi%3A10.18739%2FA2K35MF71", "downloadLink": "https://arcticdata.io/catalog/view/doi%3A10.18739%2FA2K35MF71#urn%3Auuid%3A15830bf6-1d20-405f-90c6-5011058fc8fd", "id": "doi:10.18739/A2K35MF71", "visible": false, "notification": { "style": "blue" }, "cesiumOptions": { "url": "https://arcticdata.io/data/tiles/10.18739/A2K35MF71/urn:uuid:15830bf6-1d20-405f-90c6-5011058fc8fd/band_1/WGS1984Quad/{TileMatrix}/{TileCol}/{TileRow}.png", "tilingScheme": "GeographicTilingScheme", "rectangle": [ -171.329107983504, 66.16074244427435, -136.6488120854937, 72.25092330368847 ] }, "colorPalette": { "paletteType": "categorical", "property": "DLB Classification", "colors": [ { "color": "#FC8D59", "value": "No Drained Lake Basin" }, { "color": "#FFFFBF", "value": "Ambiguous" }, { "color": "#91BFDB", "value": "Drained Lake Basin" } ] } }, { "type": "WebMapTileServiceImageryProvider", "label": "Surface Water Index trend 2000-2021", "visible": false, "cesiumOptions": { "url": "https://arcticdata.io/data/tiles/10.18739/A2037V/urn:uuid:ea99e31b-572a-4175-92d2-0a4a9cdd8366/band_1/WGS1984Quad/{TileMatrix}/{TileCol}/{TileRow}.png", "tilingScheme": "GeographicTilingScheme", "rectangle": [ -179.91531896747117, 50.16996707215903, 179.91531896747247, 80.0978646943821 ] }, "notification": { "style": "blue" }, "opacity": 0.9, "colorPalette": { "paletteType": "continuous", "property": "Trend in average July SWI", "colors": [ { "color": "#872817", "value": -0.0023 }, { "color": "#cd4e03", "value": -0.001788888888888889 }, { "color": "#e98a1f", "value": -0.0012777777777777779 }, { "color": "#f7d054", "value": -0.0007666666666666668 }, { "color": "#fff29a", "value": -0.00025555555555555574 }, { "color": "#c1e8f2", "value": 0.00025555555555555574 }, { "color": "#81c4dc", "value": 0.0007666666666666664 }, { "color": "#4d9ccb", "value": 0.0012777777777777779 }, { "color": "#115ca3", "value": 0.0017888888888888885 }, { "color": "#052350", "value": 0.0023 } ] }, "attribution": "Webb, Elizabeth E., Anna K. Liljedahl, Jada A. Cordeiro, Michael M. Loranty, Chandi Witharana, and Jeremy W. Lichstein (2022), Permafrost thaw drives surface water decline across lake-rich regions of the Arctic, Nature Climate Change, doi.org/10.1038/s41558-022-01455-w

Webb, Elizabeth E. (2022), Pan-Arctic surface water (yearly and trend over time) 2000-2021, Arctic Data Center, doi:10.18739/A2037V", "description": "Surface water change has been documented across the Arctic due to thawing permafrost and changes in the precipitation/evapotranspiration balance. This dataset uses Moderate Resolution Imaging Spectroradiometer (MODIS) data to track changes in surface water across the lake-rich regions of the northern permafrost zone over the past two decades. The superfine water index (SWI) is a unitless global water cover index developed specifically for MODIS data and validated in high northern latitudes. Variation in SWI can also track changes in surface water that occur at the sub-MODIS pixel scale (i.e., changes in water bodies smaller a MODIS pixel, ~500 meters (m)). A change in SWI of -0.002 yr-1 corresponds to ~3% decrease in percent surface water cover over 20 years (e.g., a change from 15% to 12% surface water cover). Here, red represents a negative trend (i.e., drying) and blue represents a positive trend (i.e., wetting).", "moreInfoLink": "https://arcticdata.io/catalog/view/doi:10.18739/A2037V", "downloadLink": "https://arcticdata.io/catalog/view/doi%3A10.18739%2FA2037V#urn%3Auuid%3Aea99e31b-572a-4175-92d2-0a4a9cdd8366" }, { "label": "Permafrost Zones", "icon": "urn:uuid:25d227f8-bc97-403f-a64d-5b76e741f31a", "type": "Cesium3DTileset", "visible": false, "opacity": 0.4, "description": "This biophysical permafrost zonation map was produced using a rule-based GIS model that integrated a new permafrost extent, climate conditions, vegetation structure, soil and topographic conditions, as well as a yedoma map. Permafrost in this map is classified into five types: climate-driven, climate-driven/ecosystem-modified, climate-driven/ecosystem protected, ecosystem-driven, and ecosystem-protected. 81% of the permafrost regions in the Northern Hemisphere are modified, driven, or protected by ecosystems, indicating the dominant role of ecosystems in permafrost stability in the Northern Hemisphere. Permafrost driven solely by climate occupies 19% of permafrost regions, mainly in High Arctic and high mountains areas, such as the Qinghai-Tibet Plateau.", "moreInfoLink": "https://iopscience.iop.org/article/10.1088/1748-9326/ac20f3", "downloadLink": "https://doi.org/10.11888/Geocry.tpdc.271659", "attribution": "Y.Ran, Y.; M. Torre Jorgenson.; Li, X.; Jin, H.; Wu, T.; Li, R.; Cheng, G. (2021): A biophysical permafrost zonation map in the Northern Hemisphere (2000-2016). National Tibetan Plateau Data Center, https://doi.org/10.11888/Geocry.tpdc.271659", "cesiumOptions": { "ionAssetId": "634560" }, "colorPalette": { "paletteType": "categorical", "property": "Type", "label": "Zone type", "colors": [ { "value": "Climate-driven", "color": "#FF3720" }, { "value": "Climate-driven/ecosystem-modified", "color": "#0370FE" }, { "value": "Climate-driven/ecosystem protected", "color": "#BFD1FF" }, { "value": "Ecosystem-driven", "color": "#4DE603" }, { "value": "Ecosystem-protected", "color": "#267301" }, { "value": null, "color": "#ffffff" } ] } }, { "label": "Surface Water", "icon": "urn:uuid:c4b53e6f-814d-4c22-a159-a4164daaf86f", "type": "Cesium3DTileset", "visible": false, "description": "This sub-meter resolution surface water layer was derived from the high spatial resolution commercial satellite imagery provided by the Polar Geospatial Center. This layer shows a sample of the data in North Slope, Alaska, USA.", "attribution": "Kaiser S, Grosse G, Boike J, Langer M. Monitoring the Transformation of Arctic Landscapes: Automated Shoreline Change Detection of Lakes Using Very High Resolution Imagery. Remote Sensing. 2021; 13(14):2802. https://doi.org/10.3390/rs13142802", "moreInfoLink": "https://doi.org/10.3390/rs13142802", "cesiumOptions": { "ionAssetId": "634566" }, "colorPalette": { "paletteType": "categorical", "colors": [{ "color": "#33b1ff" }] }, "filters": [ { "filterType": "categorical", "property": "DN", "values": [0] } ], "notification": { "badge": "Preview", "style": "yellow", "message": "Pan-arctic coverage will be available for this layer soon! While the data pipeline is under development, a subset of the data is available here." } }, { "label": "Lakes", "icon": "urn:uuid:c4b53e6f-814d-4c22-a159-a4164daaf86f", "type": "Cesium3DTileset", "visible": false, "description": "The data quantify the abundance and distribution of the permafrost region disturbance (PRD) of lakes and their dynamics, using trend analyses of 30-m-resolution Landsat imagery from 1999-2014 and auxiliary datasets. The dataset spans a transects in Eastern Canada.", "moreInfoLink": "https://doi.pangaea.de/10.1594/PANGAEA.922808", "downloadLink": "https://apgc.awi.de/dataset?tags=Lakes&product=Permafrost+Region+Disturbance&tags=Landsat", "attribution": "Nitze, Ingmar; Grosse, Guido; Jones, Benjamin M; Romanovsky, Vladimir E; Boike, Julia (2018): Remote sensing quantifies widespread abundance of permafrost region disturbances across the Arctic and Subarctic, Datasets. PANGAEA, https://doi.org/10.1594/PANGAEA.894755", "id": "https://doi.org/10.1594/PANGAEA.922808", "cesiumOptions": { "ionAssetId": "634564" }, "colorPalette": { "paletteType": "categorical", "colors": [{ "color": "#33b1ff" }] }, "notification": { "badge": "Preview", "style": "yellow", "message": "Pan-arctic coverage will be available for this layer soon! While the data pipeline is under development, a subset of the data is available here." } }, { "label": "Bing Satellite imagery", "icon": "urn:uuid:ff153eab-490b-46a4-b11e-47e0592735f6", "type": "IonImageryProvider", "description": "Global satellite imagery down to 15 cm resolution in urban areas. This satellite imagery is not what was used to produce the other data layers. Due to the license restrictions associated with the the satellite imagery used to produce the other data layers, we are not able to display it publicly.", "attribution": "Data provided by Bing Maps © 2021 Microsoft Corporation", "moreInfoLink": "https://www.microsoft.com/maps", "cesiumOptions": { "ionAssetId": "2" } } ], "terrains": [ { "label": "Arctic DEM", "type": "CesiumTerrainProvider", "cesiumOptions": { "ionAssetId": "3956", "requestVertexNormals": true } } ], "showToolbar": true, "toolbarOpen": true, "showScaleBar": true, "showFeatureInfo": true } ```