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

Why is layer source attribute init only? #119

Closed
LouAdrien opened this issue Mar 19, 2019 · 1 comment
Closed

Why is layer source attribute init only? #119

LouAdrien opened this issue Mar 19, 2019 · 1 comment

Comments

@LouAdrien
Copy link

Hello, first thanks for the amazing work, these bindings are extremely useful.

My question is : why does the "source" setting of the mgl layer is only possible at the init time?
There are many use cases where someone would need to change a layer source data according to some logic. Are there some restrictions that would prevent such a use case?

Thanks in advance,

@Wykks
Copy link
Owner

Wykks commented Jul 3, 2019

Hi!

Afaik, mapbox-gl doesn't provide a way to update the source of a layer. The only way to implement this would be to remove/re-add the layer.
This pattern has proven to cause issues (#139), so it's going to stay like that until mapbox-gl implement a updateLayer method.

edit: ref issue in mapbox-gl: mapbox/mapbox-gl-js#6895

For now, you can create multiple layers and use *ngIf to switch the source for example.

(sorry for the late response..)

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

3 participants