openlayers / openlayers/openlayers
Palette styling of WebGL layers in separate canvases
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 12.6k
- Forks
- 3.2k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 21
Description
Describe the bug
We are working with webgl layers styled with palette style (we used simple styling with one color only to illustrate our problem) on different canvases (using separate className) - we need separate canvases for histogram purposes.
Problem occures when removing first of layers. All styling info for second layer is missing - so it renders as black rectangle.
When removing second layer, everything seems to work ok, and first layer is rendered correctly. Also we haven't notice problem when using single canvas for both webgl layers. The problem occurs when second layer is styled with palette style.
As workaround for now, we added refresh of style: layer.setStyle(layer.style_) but it forces also reload of tiles.
To Reproduce
- open https://codesandbox.io/s/webgl-tile-layers-4dmioz
- wait for red and green layer is rendered
- then click to upper right delete button
- this step remove first layer from map with map.removelayer() and second layer is rendered without style (black rectangle)
Expected behavior
when we set style for second layer after removing of first layer, it works.
uncomment line 74 for correct behaviour.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked CodeSandbox reproduction and inspect the two WebGL layers using separate className values. Reproduce removing the first layer with map.removeLayer(), then compare it with removing the second layer and with uncommenting line 74, which calls layer.setStyle(layer.style_). Done means the second layer retains its palette styling without forcing a tile reload.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100