-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Modifying GeoJSON source #1954
Comments
map.getSource('route').setData(source); You're supposed to pass GeoJSON to |
Thanks! Is there a way to add data instead of overwriting it? |
@luixo, not currently. Maybe in the long term. Until then we're working on try to make adding faster. |
I'm strangely getting the opposite issue, where setData is adding new points on top of old points instead of the desired behavior of overwriting. Any pointers? |
I just stumbled upon this but looks like an API token is pasted in the jsfiddle. |
Thank you. The token in the fiddle is already invalidated. |
@shuoch can you reproduce such behaviour? I think some feature with setData for new points over old will be awesome also. (I mean this #1954 (comment)). cc @mcwhittemore |
I'm building an app with dynamic markers. My first attempt to update them was just removing layer & source and adding new ones, but the view was flickering on each update.
Then I found a
setData
method for source, but it throws with an error:Uncaught DataCloneError: Failed to execute 'postMessage' on 'Worker': An object could not be cloned.
I made an example: https://jsfiddle.net/mr0pzv5c/
The text was updated successfully, but these errors were encountered: