Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more config options for layers in the Map Config #2187

Closed
3 tasks done
robyngit opened this issue Aug 28, 2023 · 3 comments · Fixed by #2482 or #2488
Closed
3 tasks done

Add more config options for layers in the Map Config #2187

robyngit opened this issue Aug 28, 2023 · 3 comments · Fixed by #2482 or #2488
Assignees
Labels
cesium DRP Issues related to the Defense Resiliency Platform enhancement pdg Permafrost Discovery Gateway Requested by: Hosted repo Features requested by a DataONE hosted repository
Milestone

Comments

@robyngit
Copy link
Member

robyngit commented Aug 28, 2023

The layers that show in the Cesium map are configured with JSON. We would like to add a few more configuration options to the layer config:

  • clickFeatureAction: This is currently set at the map level, to either "showDetails" or "zoom". With show details, a layer panel pops up with additional info about the feature. With zoom, the map zooms into the bounding sphere for that feature. There are cases where some layers should zoom on click(geohashes) and others should show details on click (other vector layers in a data catalog). If no action is set, it should default to the map-level behaviour.

  • showOpacitySlider a boolean that determines whether to show an opacity slider for the layer in the layer details panel

  • showInLayerList: Set to false to hide this layer in the layer list. Defaults to true. This will be used for issue Enable drawing arbitrary polygons on the Cesium map #2180, because we don't want to show the layer that we create that stores the polygon a user draws on the map. It could also be useful for any layers a portal wants shown all the time - e.g. a base layer.

@robyngit robyngit added enhancement pdg Permafrost Discovery Gateway cesium DRP Issues related to the Defense Resiliency Platform labels Aug 28, 2023
@robyngit robyngit added this to the 2.27.0 milestone Aug 28, 2023
@robyngit robyngit self-assigned this Aug 28, 2023
robyngit added a commit that referenced this issue Aug 31, 2023
- Add MapInteraction, GeoPoint and GeoBoundingBox models
- Make the CesiumWidgetView methods smaller and more modular
- Move Map model attributes to the MapInteraction model (selectedFeatures, currentPosition, currentScale, and currentViewExtent)
- In MapAsset models, listen for changes to cesiumOptions and update Cesium model
- In map connectors, don't use new models as defaults to avoid instantiating new models unnecessarily
- Pass GeoPoint and GeoScale models directly to the ScaleBarView

Issues #2189, #2180, #2187
@robyngit
Copy link
Member Author

showInLayerList has been implemented in #2204

@robyngit robyngit modified the milestones: 2.27.0, 2.28.0 Oct 26, 2023
@iannesbitt iannesbitt added the Requested by: Hosted repo Features requested by a DataONE hosted repository label Dec 8, 2023
@robyngit robyngit modified the milestones: 2.28.0, 2.29.0 Feb 8, 2024
@robyngit robyngit removed this from the 2.29.0 milestone Apr 18, 2024
@robyngit robyngit assigned alonakos and unassigned iannesbitt and robyngit Jul 10, 2024
@robyngit robyngit added this to the 2.31.0 milestone Jul 10, 2024
@robyngit
Copy link
Member Author

  • See this guide for how we configure Cesium maps in MetacatUI portals, and see the MapConfig for all configuration options.

  • The MapAssetConfig shows the configuration options for each layer in a Cesium map (configured as layers in the MapConfig).

  • The goal of this issue is to be able to add two more options to that MapAssetConfig:

    • showOpacitySlider - a boolean that determines whether to show an opacity slider for the layer in the layer details panel
    • clickFeatureAction - a string that determines what action to take when a feature is clicked on the layer. Options are showDetails or zoom.

    e.g.

    {
      "label": "Local Stories",
      "layerId": "ls",
      "type": "GeoJsonDataSource",
      "opacity": 0.75,
      "showOpacitySlider": false,
      "clickFeatureAction": "zoom",
      "cesiumOptions": {
                          "data": "https://www.leonetwork.org/en/explore/posts?query=&type=TWEET&type=POST&type=ARTICLE&mode=geojson_compact&region=&polygon=&bbox=&minlat=&maxlat=&near=&radius=&categories=PERMAFROST%7cPermafrost+Change&categories_anyOrAll=ANY&fromdate=&todate="
                      }
    }
  • The MapAsset model (src/js/models/maps/assets/MapAsset.js) handles the majority of the configuration for each layer in a Cesium map.

  • Other models in the src/js/models/maps/assets/ directory are just extensions of the MapAsset model for specific types of layers.

  • The LayerDetailsView (src/js/views/maps/LayerDetailsView.js) is responsible for rendering the panel that shows info and controls for each layer, including the opacity slider.

  • A quick way to test changes to the map config during development is to directly modify the map config options that are passed to the Map model in the initialize method. For example, you could add the following to the very top of Map.initialize:

        config.layers = [
       {
         "label": "Local Stories",
         "layerId": "ls",
         "type": "GeoJsonDataSource",
         "opacity": 0.75,
         "showOpacitySlider": false,
         "clickFeatureAction": "zoom",
         "cesiumOptions": {
           "data": "https://www.leonetwork.org/en/explore/posts?query=&type=TWEET&type=POST&type=ARTICLE&mode=geojson_compact&region=&polygon=&bbox=&minlat=&maxlat=&near=&radius=&categories=PERMAFROST%7cPermafrost+Change&categories_anyOrAll=ANY&fromdate=&todate="
         }
       }
     ]

    Now any Cesium map you load locally will be overridden to show just one "Local Stories" layer with the two new configuration options that we want to use!

@robyngit robyngit linked a pull request Jul 17, 2024 that will close this issue
@alonakos
Copy link

showOpacitySlider implemented in 2482

@robyngit robyngit linked a pull request Jul 24, 2024 that will close this issue
alonakos added a commit to alonakos/metacatui that referenced this issue Aug 9, 2024
alonakos added a commit to alonakos/metacatui that referenced this issue Aug 10, 2024
 - unit tests for zoom and showDetails Issue NCEAS#2187
- resolved unit test issues
robyngit pushed a commit that referenced this issue Aug 15, 2024
* added clickFeatureAction config

* reviewdog edits

* dogreview

* linting

* Revert "linting"

This reverts commit 702e1a9.

* mapview removed check

* pr comments

* PR comments

* removed accidental commit

* Update Map.js

* Update MapView.js

* Update MapView.js

* Update MapView.js

* unit tests for MapInteractions.js  - unit tests for zoom and showDetails Issue #2187

* unit tests for MapInteractions.js 

 - unit tests for zoom and showDetails Issue #2187
- resolved unit test issues

---------

Co-authored-by: Alona Kosobokova <alonakosobokova@MacBook-Pro-Alona.local>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cesium DRP Issues related to the Defense Resiliency Platform enhancement pdg Permafrost Discovery Gateway Requested by: Hosted repo Features requested by a DataONE hosted repository
Projects
None yet
3 participants