Orcasa-Platform / orcasa

A Horizon Europe project to restore soil earth
https://orcasa-client.vercel.app
MIT License
2 stars 0 forks source link

Interaction popups for map layers #141

Closed Bluesmile82 closed 8 months ago

Bluesmile82 commented 9 months ago

Show interactive data on click on the layers through a popup.

Check the interaction config on staging. There are more complex configuration on the layers with tabs or select like "Historic change"

https://vizzuality.atlassian.net/browse/ORC-226?atlOrigin=eyJpIjoiM2RlNmUwYTUwZGVhNGQ5YWFiYWY0MmE2NjczZjdlMTAiLCJwIjoiaiJ9

For some layers (Clay content and World Reference Base (2006) Soil Groups) we needed to specify the correct Bbox API format (overpass, nominatim, default). This is a new parameter on the CMS. If not specified the default will be the normal bbox format (WSEN)

Attention: We need to pass as an argument JSON_CONFIGURATION to the parseConfig method. This is not ideal but is because we are using it to get the default value for the layers interaction on complex layers and the deck.gl library is having problems when is server side rendered. At least in the version we are using. Here is the issue for more info: https://vizzuality.slack.com/archives/D5REHE38E/p1706610946819099 The solution is to import dynamically the Decode Layer which is part of the JSON_CONFIGURATION and was causing the app to crash if we were on SSR. The map will always render on the client anyways.

Example of interaction_config on Global Soil Organic Carbon Map v1.5 (GSOC) layer (already on staging):

{
  "url": "https://data.apps.fao.org/map/gsrv/gsrv1/gsoc/wms?crs=EPSG:4326&request=GetFeatureInfo&transparent=true&format=image/png&exceptions=application/vnd.ogc.se_xml&styles=&feature_count=10&service=WMS&version=1.1.1&x={x}&y={y}&bbox={bbox}&width={width}&height={height}&info_format=application/json&layers=GSOCmap1.5.0&QUERY_LAYERS=GSOCmap1.5.0",
  "events": [
    {
      "type": "click",
      "values": [
        {
          "key": "SOC_Stock",
          "type": "number",
          "unit": "Mg/ha",
          "format": {
            "id": "formatLayerNumber"
          }
        }
      ]
    }
  ],
  "enabled": true
}

There are some layers where the interaction will not work and science is aware of it. E.g. Land Cover group

vercel[bot] commented 9 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
orcasa-client ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 14, 2024 11:25am
clementprdhomme commented 9 months ago

I haven't tested the code yet. Could you tell me first:

  1. Where you have updated the interaction_config objects. On the staging environment?
  2. Which layers can't have this feature?
Bluesmile82 commented 9 months ago

I haven't tested the code yet. Could you tell me first:

  1. Where you have updated the interaction_config objects. On the staging environment?
  2. Which layers can't have this feature?
  1. Yes, on staging environment. Maybe we have to review some of them. I think they still have label and missing the unit
  2. The whole Land use group and the Clay Content and World reference Base layers (These two last ones return 'Search returned no results.')
Bluesmile82 commented 8 months ago

Clay content and World Reference Base (2006) Soil Groups layers have working interaction now. This is ready for review again!

Bluesmile82 commented 8 months ago

Updated text and units in Strapi. For no data we have "At coordinates ... there is no data". We can review this later if needed.

Bluesmile82 commented 8 months ago

I think I rebased and they were added. I don't think they are needed so Ill clean them

Bluesmile82 commented 8 months ago

It's clean now. Thanks for noticing