openlayers / openlayers/openlayers

Palette styling of WebGL layers in separate canvases

Open
#14,192 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
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

  1. open https://codesandbox.io/s/webgl-tile-layers-4dmioz
  2. wait for red and green layer is rendered
  3. then click to upper right delete button
  4. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.