Hiya,
I’m trying to make a sort of masking ability for an ImageryLayer, but can’t seem to find much useful info on it. The styling of a map looks like locked to the whole of the layer, or locked to a threshold (for alpha culling). My needs would be closer to a color-mapped alpha, so instead of a threshold I’d like to specify that certain colors (original, not final mix, of course, that would be madness) can be re-mapped (or simply just alpha). I could through a lot of proxy prodding and such, but is there (or plans for) a way to either mask an imagery layer, or do color-mapping of colors to alpha?
If not, I could look into the source code and hack it that way, just wanted to ask about this here first. A typical use-case is an imported map that uses some rbg (for example some red color) for a region or something, so I’d like to add that red color to the mask so I can turn it on and off (or control the transparency).
I know that in an ideal world each layer is an actual layer, but often in these imported maps they are smooshed together into one layer. Thoughts?
Cheers,
Alex
@Alexander_Johannesen
Thank you for your question! I also really appreciate your continued support in our community forum. You help make our community a welcoming and informative environment
From my research, our API provides fairly basic tools related to ImageryLayer
and ImageryLayerCollection
. For instance, users can:
- access the imagery layers at a given location
- specify some basic styling to the entirety of the imagery layer (contrast, alpha, etc.)
- adjust the brightness of the entire imagery layer
Our API currently does not support color mapping or any other more “advanced” imageryLayer
editing feature. While I think these types of features are incredibly important, they currently are not on our roadmap.
Doing a deep dive into our source code is a great first step if these features are a priority for you. If the development process moves forward smoothly, we would be happy to review a PR with some of the functionality that you implement… but let’s not get too far ahead of ourselves
One final thought - if having a high level of control over the visual characteristics of an imagery layer is important to you, would it make sense to use a 3rd party tool to edit the imagery layers before importing them into CesiumJS? Or, is this not feasible given that you are looking to edit the imageryLayer
objects during runtime?
I am looking forward to learning more about your use case! As always, do not hesitate to reach out with more questions or concerns.
-Sam
Hi Sam,
Often these are WMS maps, so we have no control of them, apart from having to create an infrastructural proxy that could manipulate them in real-time. That’s a big rough job.
I specifically mentioned the alpha by threshold, as that’s an easy access to the same functionality where, instead of a threshold integer, you can specify if the color(s) is in our out. You’re already accessing the color rasters, so instead of a “greater than”, you could replace that with “any of these”. I understand that’s not now out-of-the-box, but wouldn’t be too hard to do. The API could do a check that if it’s an integer you use the one way, and if it’s a JSON you could do color mapping (for example). Not sure if RGB is enough, but just some thoughts around it.
Cheers,
Alex
@Alexander_Johannesen
I understand now
Regarding the overview of your potential implementation - I think these ideas make a lot of sense. I especially like the idea of checking if the input is an integer, JSON, etc. I think this would scale well and be useful for other community members.
-Sam