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

Unable to load correctly existing WMS from URL in WMS Capabilities demo #1050

Closed
ThomasG77 opened this issue Apr 12, 2024 · 2 comments
Closed

Comments

@ThomasG77
Copy link
Collaborator

ThomasG77 commented Apr 12, 2024

Steps to reproduce

I would expect with what look like a permalink (but maybe not !?) that I could see the layer displayed in the new browser tab or window.

I have a dirty implementation where I do not rely on capabilities to see the layer e.g https://labs.webgeodatavore.com/partage/wms_permalink.html#map=5.30%2F2.53%2F46.64&layer=Hydroecoregion1&url=https%3A%2F%2Fservices.sandre.eaufrance.fr%2Fgeo%2Fmdo but I want best of both world e.g the capabilities UI and the ability to share when I have an existing layer already added.

Clues about the bug

After some inspection, it seems to be a bug as in line https://github.com/Viglino/ol-ext/blob/master/examples/layer/map.wmscapabilities.html#L157, I see a reference to a loadLayer function. When I look at exact function at https://github.com/Viglino/ol-ext/blob/master/src/control/WMSCapabilities.js#L871 and I also debug using breakpoint with my URL using browser DevTools, I see the issue is that there is no recursive search.

In my particular case, there is a loop in the cap.Capability.Layer.Layer.forEach that contains only one layer.
The problem is that cap.Capability.Layer.Layer[0].Layer does contain 21 layers. Without a recursive approach, we miss some available layers and that as the loop never find the "right" layer, it does not add it (because it does a check on capability before adding the layer)

The issue is now to choose if recursive layer search is wanted and if yes, how to implement it properly.

Viglino added a commit that referenced this issue Apr 14, 2024
@Viglino
Copy link
Owner

Viglino commented Apr 14, 2024

Yes the loadLayer method only check the parent layers.
I fix it by looking layers recursively. 254429b
Now it's working fine 😄

@ThomasG77
Copy link
Collaborator Author

Fix fine for me. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants