georchestra / geonetwork

The official GeoNetwork fork for geOrchestra
GNU General Public License v2.0
9 stars 21 forks source link

[feat] allow to open 3dtiles links in mapstore #226

Closed landryb closed 1 year ago

landryb commented 1 year ago

Is your feature request related to a problem? Please describe.

geosolutions-it/MapStore2#8055 adds support to mapstore to load 3dtiles datasets from url parameters. I'd like to allow this from geonetwork, building on top of what was done in #184.

Describe the solution you'd like

From my understanding, there's a whitelisting of some 'protocols' somewhere in geonetwork to display the "visualiser" link.

I suppose we first need a "blessed" protocol type for links to 3dtiles datasets, as i havent been able to find one in the existing code nor the existing schemas. According to https://www.ogc.org/standard/3dtiles/ 3dtiles is an official standard, so i'm wondering if i can just do a PR upstream to add it to the available protocols like it was done for OGC API protocols in geonetwork/core-geonetwork@91f7f9f6850 and geonetwork/core-geonetwork@6e2f05ecc93

Describe alternatives you've considered I've started with this:

--- a/web-ui/src/main/resources/catalog/views/georchestra/module.js
+++ b/web-ui/src/main/resources/catalog/views/georchestra/module.js
@@ -32,7 +32,7 @@
       gnSearchSettings.linkTypes = {
         links: ['LINK'],
         downloads: ['DOWNLOAD'],
-        layers: ['OGC:WMS'],
+        layers: ['OGC:WMS','OGC:3DTILES','OGC:WFS'],
         maps: ['ows']

--- a/web-ui/src/main/resources/catalog/views/default/module.js
+++ b/web-ui/src/main/resources/catalog/views/default/module.js
@@ -351,16 +351,18 @@
       function buildAddToMapConfig(link, md) {
         var config = {
           uuid: md ? md.uuid : null,
           type:
             link.protocol.indexOf("WMTS") > -1
               ? "wmts"
               : link.protocol == "ESRI:REST" || link.protocol.startsWith("ESRI REST")
               ? "esrirest"
+              : link.protocol.toLowerCase().indexOf("3dtiles") > -1
+              ? "3dtiles"
               : "wms",
           url: $filter("gnLocalized")(link.url) || link.url
         };

         var title = link.title;

but with a metadata having this online resource definition:

<gmd:CI_OnlineResource>
  <gmd:linkage>
    <gmd:URL>
      https://3d.craig.fr/datasets/Domerat_bati3d/3dtiles/tileset.json
    </gmd:URL>
  </gmd:linkage>
  <gmd:protocol>
    <gco:CharacterString>OGC:3DTILES</gco:CharacterString>
  </gmd:protocol>
  <gmd:name>
    <gco:CharacterString>3dtiles domérat</gco:CharacterString>
  </gmd:name>
</gmd:CI_OnlineResource>

i only have a visit link so far.

Trying with OGC:WMS-3DTILES for the protocol, there's a "ajouter la couche à la carte" (eg add service layer to map) button (instead of "visualiser" like for WMS/WFS?) and mapstore is opened with the right parameters: [{"type":"CATALOG:ADD_LAYERS_FROM_CATALOGS","layers":["3dtiles domérat"],"sources":[{"type":"3dtiles","url":"https%3A%2F%2F3d.craig.fr%2Fdatasets%2FDomerat_bati3d%2F3dtiles%2Ftileset.json"}]}]

help welcome @fgravin @tkohr , i'm pretty sure there's not much code to change to support 3dtiles, but i'm still digging..

fvanderbiest commented 1 year ago

Thanks for reaching out Landry. Yes, this is a clear candidate for an upstream PR. I'm +1 on adding this feature.

landryb commented 1 year ago

ok, i think i have something a bit crude but which works on top of 4.0.6. My proposal would be to port my changes to 4.2, PR first this repo, separating the georchestra-only bits (the "send to mapstore" via our custom templatized url in the georchestra view) from the geonetwork bits, and after feedback from upstream eventually push the geonetwork bits upstream.

landryb commented 1 year ago

the codepaths used changed a bit since 195b8495 and i'm not sure if the bits in https://github.com/geonetwork/core-geonetwork/blob/2731e560fd9e3a8cea16047082cf557d3c0978c5/web-ui/src/main/resources/catalog/components/metadataactions/RelatedResourcesService.js#L91 are called, in my testing on 4.0.6 (sending to mapstore from the metadata view, or from the search results view) they weren't... so i don't really know where they're called from.