-
Notifications
You must be signed in to change notification settings - Fork 61
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
How can I update the source and layer data on the rendered map? #50
Comments
Hi, I am having the same issue, did you find any solution ? |
In the SvelteMapbox example, there's a component called "Earthquakes" which is where the local data is set. You can see how the source and layers are configured in there. For my case, I changed the
Whenever the data changes, I set I then set P.S. I also had to move the |
Sorry, I realized I shouldn't have closed the issue, although the solution above worked well for me |
Thanks to put me on the track, the Earthquakes example misled me and I did not think it was a custom marker. |
thanks to everyone on this thread for helping with a similar issue. Sharing my solution because @sbutler-gh 's solution above did not work for me: I'm not able to set However wrapping
|
Is there any way to programatically update the source and layer data on the rendered map?
For example, on map initialization, including code like this:
And when the location changes (via Geocoder), I would fetch a geojson for that location and update the map's source and layers liks this:
My code is similar to the demos in the readme, and I've tried a few ways -- for example,
mapComponent.getSource('selectedLocation')
But everything is returning errors thus far.
Any help/advice would be much appreciated!
The text was updated successfully, but these errors were encountered: