Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating deckgl map in shiny removes previous layer #214

Open
hdmm3 opened this issue Mar 2, 2023 · 1 comment
Open

Updating deckgl map in shiny removes previous layer #214

hdmm3 opened this issue Mar 2, 2023 · 1 comment

Comments

@hdmm3
Copy link

hdmm3 commented Mar 2, 2023

Hi @crazycapivara,

I'm using deckgl_proxy and update_deckgl to add layers to a previously rendered map in my Shiny app. I'm using one observeEvent for each layer I want to add to the map. The goal is that each layer is added on top of each other after each observeEvent. However, each time deckgl_proxy is called inside the event it removes the previously rendered layers and only leaves the layers from the original renderDeckgl and the new one from the event. If this is the expected behaviour, could you please suggest a workaround?

Also, is there a way to programmatically remove each layer?

Thanks,

@crazycapivara
Copy link
Owner

Hi @hdmm3
yes, this is the expected behaviour, because deck.gl uses the The Reactive Programming Paradigm (see also https://deck.gl/docs/developer-guide/using-layers/#should-i-be-creating-new-layers-on-every-render). Therefore you have to add all layers that should be rendered on an update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants