Please tell me how can determine it not initially, but dynamically, for example, by choosing from a list of all possible values that I know. Not as shown in the code const layer= new WMSLayer({
url: "MyGeoserverUrl",
sublayers: [{ name: "World" }],
}); This is very understandable. The question is whether it is possible to change this property on the go by choosing any value from the built interface. For example, there are such layers list {"World","Name1","Name2"}. When i choose "Name2" So write like this layer.sublayers = ... //code.
There was already a similar topic, but no one could give a clear answer. Apparently no one knows. Although I saw an example in the documentation that they write this way in the code. But the code doesn't work at all! I am using Angular.
And in addition, a very important question on the same topic. There is such a great example Learn how to change the basemap layer in a map. https://developers.arcgis.com/javascript/latest/change-the-basemap-layer/#create-a-new-pen
Is it even possible to do something similar for 3D WMSLayer?
I beg you, thank you very much and I really hope that someone knows and answers, please!
Hi @DimaY
If you're building a UI element to swap between various sublayers, I recommend to work with the sublayer visibility. Here's a sample app:
https://codepen.io/gsoosalu/pen/bGMNveY
Hope this helps you further. Let me know if you run into any further issues.
Thank you very much for your attention and your response. This is a very good idea! But... In code to make just visible true to Sublayer, every time you need to run through the cycle of all layers and look for it by name. Which is very very slow, long and inefficient. Really much easier just to change sublayers for WMSLayer. I saw code examples here as I wrote above, but he does not want to be friends with angular. If it were easy, I wouldn't be posting on the forum. Possible get out to come up with all sorts of tricks, write additional services and assign WMSLayer with new sublayers by selected Name. But there is no beautiful and optimal solution yet. Only everything topsy-turvy. Despite the fact that properties exist and they can be controlled in some way. But there is no explanation. Unfortunately.