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

Map#setLayerSource to allow changing a layer's source #6895

Open
andrewharvey opened this issue Jun 30, 2018 · 1 comment
Open

Map#setLayerSource to allow changing a layer's source #6895

andrewharvey opened this issue Jun 30, 2018 · 1 comment

Comments

@andrewharvey
Copy link
Collaborator

andrewharvey commented Jun 30, 2018

This would let you change a layer's source. Currently you need to

  1. getLayer (due to Map#getLayer should return the serialized representation #3713 you need to getStyle then find the layer)
  2. removeLayer
  3. addLayer

This would make it easier to to use local GeoJSON sources on the client side together with layers from Mapbox Studio. In Studio you can't create local GeoJSON source layers so you need to use a dummy source, which requires swapping out on the client side.

@vinayakkulkarni
Copy link

Yep, swapping out geojson can be a pain in the a$$, setData() feels kind of a hack.. would really appreciate a way to swap out geojson..
maybe something like: map.setSource('layer-id', <some geosjon>)

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

No branches or pull requests

2 participants