-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Enabling/disabling sources on demand. (Enhancement request). #818
Comments
When you mean "enable/disable sources" what are you referring to? You can currently enable/disable style classes and load different style.json files. |
I experimented with getAppliedStyleClasses with bright style to figure out what it is. But it always returns an array with 0 objects. I've included below specific uses cases. 1.) The style.json file has 3 different sources. These need to be enabled conditionally. When a source is enabled/disabled any layer referring to that source in style.json should get enabled/disabled. The only way I have been able to figure out to do this is to create a new style.json and apply it. 2.) For a layer with specific "id" in style.json file, I need to do things like the following: |
So why are enabling disabling sources? What exactly are you trying to do? The reason you get 0 length array is because bright does not have any classes in its style json. Try it with outdoors and you will get night and day styles. |
Thank you very much for the response. Use case #1:
Of the two vector source rendered on the basemap, at least one will be active at any time. Dynamically generated style.json approach is cumbersome for modeling this (Also due to the start/stop bug, unreliable at the moment). Ideally I would like to have a static style.json and enable/disable Sources dynamically. Use case # 2:
|
Thanks for the info I now see what you are trying to do. I wonder if we can make the logic smarter to prevent loading sources not referenced in the current class. Thoughts @jfirebaugh? |
This is part of #837. |
At the moment the only way to enable/disable sources is to change the style.json file. It would be useful to be able to do so programmatically via an API exposed through objective C wrapper.
The text was updated successfully, but these errors were encountered: