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

allow to load 3dtiles tileset via viewer parameters #8055

Closed
landryb opened this issue Apr 5, 2022 · 5 comments · Fixed by #9021 or #9060
Closed

allow to load 3dtiles tileset via viewer parameters #8055

landryb opened this issue Apr 5, 2022 · 5 comments · Fixed by #9021 or #9060

Comments

@landryb
Copy link
Collaborator

landryb commented Apr 5, 2022

Description

right now as documented on
https://mapstore.readthedocs.io/en/latest/developer-guide/map-query-parameters/#add-layers only wms/wmts/wfs is supported, would be nice to be able to load 3dtiles tilesets the same way, eg

?actions=[{"type":"CATALOG:ADD_LAYERS_FROM_CATALOGS","layers":["XXX?"],"sources":[{"type":"3dtiles","url":"https://url/to/tileset.json"}]}]

@landryb
Copy link
Collaborator Author

landryb commented Mar 10, 2023

Something i thought about, so far in georchestra's geonetwork 4 and in datahub we use an url template such as /mapstore/#/?actions=[{"type":"CATALOG:ADD_LAYERS_FROM_CATALOGS","layers":["${layer_name}"],"sources":[{"url":"${service_url}","type":"${service_type}"}]}] to open all viewable layers in ms2 from gn4. I see in the doc linked above that links such as #/viewer/openlayers/config?actions= should also work, is it preferred ?

Because in the 3dtiles case, we will want to open the dataset in the cesium view, eg #/viewer/cesium/config?actions= but i dont think it'll be possible to specialcase that in the GN configuration about the url template.

So my question is, when using the "generic" handler such as /mapstore/#?actions without specifying the viewer type, i suppose by default the ol viewer will open... or would it make more sense to automagically switch to the cesium viewer if a 3dtiles layer is being added via this action ?

@allyoucanmap
Copy link
Contributor

allyoucanmap commented Mar 10, 2023

Something i thought about, so far in georchestra's geonetwork 4 and in datahub we use an url template such as /mapstore/#/?actions=[{"type":"CATALOG:ADD_LAYERS_FROM_CATALOGS","layers":["${layer_name}"],"sources":[{"url":"${service_url}","type":"${service_type}"}]}] to open all viewable layers in ms2 from gn4. I see in the doc linked above that links such as #/viewer/openlayers/config?actions= should also work, is it preferred ?

Recently we included an improvement in MapStore to persist the visualization mode 2D or 3D in the saved map and contextually we removed the map libraries (leaflet, openlayers or cesium) from the pathname. The current pathname #/viewer/:mapLibrary/:mapId will be still supported for backward compatibility reasons but the pathname without map library visible will be preferred. So the future direction is to hide from the end user the library name in the path of the viewer (v 2023.02.00). The documentation needs to be updated, thanks for pointing it out!

So my question is, when using the "generic" handler such as /mapstore/#?actions without specifying the viewer type, i suppose by default the ol viewer will open... or would it make more sense to automagically switch to the cesium viewer if a 3dtiles layer is being added via this action ?

Yes, we are thinking to add a check in the CATALOG:ADD_LAYERS_FROM_CATALOGS action workflow to switch to the 3D view if one of the layers included is of type "3dtiles"

@landryb
Copy link
Collaborator Author

landryb commented Mar 10, 2023

Recently we included an improvement in MapStore to persist the visualization mode 2D or 3D in the saved map and contextually we removed the map libraries (leaflet, openlayers or cesium) from the pathname. The current pathname #/viewer/:mapLibrary/:mapId will be still supported for backward compatibility reasons but the pathname without map library visible will be preferred. So the future direction is to hide from the end user the library name in the path of the viewer (v 2023.02.00). The documentation needs to be updated, thanks for pointing it out!

Oh great news, that will simplify things since by essence some maps only make sense in 3d mode, others might make only sense in 2d mode and some in both.. so it's a good idea to add that to the map itself.

So my question is, when using the "generic" handler such as /mapstore/#?actions without specifying the viewer type, i suppose by default the ol viewer will open... or would it make more sense to automagically switch to the cesium viewer if a 3dtiles layer is being added via this action ?

Yes, we are thinking to add a check in the CATALOG:ADD_LAYERS_FROM_CATALOGS action workflow to switch to the 3D view if one of the layers included is of type "3dtiles"

perfect then, thanks !

@landryb
Copy link
Collaborator Author

landryb commented Mar 20, 2023

I've slightly tested #9021 here with http://localhost:8081/#/viewer/config?actions=[{%22type%22:%22CATALOG:ADD_LAYERS_FROM_CATALOGS%22,%22layers%22:[%22Domerat%22],%22sources%22:[{%22type%22:%223dtiles%22,%22url%22:%22https://3d.craig.fr/datasets/Domerat_bati3d/3dtiles/tileset.json%22,%22title%22:%22Domerat%22}]}] and here's what i see:

  • the viewer opens as 2d (the default)
  • automatically switches to 3d mode as expected
  • adds the 3dtiles layer named 'Domerat', and if i zoom on the layer extent i see the 3dtiles (floating in the sky, but that's a known dataset issue)

same thing, also working fine with http://3d.craig.fr/datasets/Aurillac/bati_avec_tecture/tileset.json (plain http), but this time as expected the dataset is on the ground with the default ellipsoid terrain.

also tested the shorter form without specifying the layer title but the dataset url twice (eg http://localhost:8081/#/viewer/config?actions=[{"type":"CATALOG:ADD_LAYERS_FROM_CATALOGS","layers":["http://3d.craig.fr/datasets/Aurillac/3dtiles/tileset.json"],"sources":[{"type":"3dtiles","url":"http://3d.craig.fr/datasets/Aurillac/3dtiles/tileset.json"}]}]) - a layer named '3dtiles' is added to the map, and i can correctly zoom on it.

i've also tested directly loading cesium using http://localhost:8081/#/viewer/cesium/config?actions=[{"type":"CATALOG:ADD_LAYERS_FROM_CATALOGS","layers":["Domerat"],"sources":[{"type":"3dtiles","url":"https://3d.craig.fr/datasets/Domerat_bati3d/3dtiles/tileset.json","title":"Domerat"}]}] and with this url (i guess now unsupported?):

so globally, this seems to work fine in the general case, great stuff.

Thinking out loud, the behaviour isnt 100% consistent with the Metadata explorer plugin where the viewer zooms to the newly added layer (a behaviour that can be infuriating sometimes, so can be disabled with "zoomToLayer": false in the plugin config), i know this can be done by specifying manually &center=x,y&zoom=z but that's dataset-specific (so can't be used if the url call is templated by something, geonetwork 4 in georchestra's usecase) and i wonder if it wouldn't be better for the ADD_LAYERS_FROM_CATALOGS action to zoom to the added layer in our case.

@tdipisa
Copy link
Member

tdipisa commented Mar 21, 2023

@landryb

Thinking out loud, the behaviour isnt 100% consistent with the Metadata explorer plugin where the viewer zooms to the newly added layer (a behaviour that can be infuriating sometimes, so can be disabled with "zoomToLayer": false in the plugin config), i know this can be done by specifying manually &center=x,y&zoom=z but that's dataset-specific (so can't be used if the url call is templated by something, geonetwork 4 in georchestra's usecase) and i wonder if it wouldn't be better for the ADD_LAYERS_FROM_CATALOGS action to zoom to the added layer in our case.

It could a possibility of course but not as part of this issue because it is not strictly related and we risk to add more logic than expected. We should open a new issue for this to keep track for the future.

@tdipisa tdipisa modified the milestones: 2023.02.00, 2023.01.01 Mar 21, 2023
allyoucanmap added a commit that referenced this issue Mar 24, 2023
Co-authored-by: Lorenzo Natali <lorenzo.natali@geosolutionsgroup.com>
allyoucanmap added a commit to allyoucanmap/MapStore2 that referenced this issue Mar 29, 2023
…ters (geosolutions-it#9021)

Co-authored-by: Lorenzo Natali <lorenzo.natali@geosolutionsgroup.com>
tdipisa pushed a commit that referenced this issue Mar 29, 2023
… parameters (#9021) (#9060)

* #8055 allow to load 3dtiles tileset via viewer parameters (#9021)

Co-authored-by: Lorenzo Natali <lorenzo.natali@geosolutionsgroup.com>

* fix tests

---------

Co-authored-by: Lorenzo Natali <lorenzo.natali@geosolutionsgroup.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment