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

Recreation of the layers without page refresh #36

Open
JimBratsos opened this issue Apr 13, 2021 · 2 comments
Open

Recreation of the layers without page refresh #36

JimBratsos opened this issue Apr 13, 2021 · 2 comments

Comments

@JimBratsos
Copy link

Good afternoon,

I have stumbled across an issue during the development of mine. I am calling a GeoJSON layer using the URL from my server, and I would like that it gets dynamically re-created every few seconds on the map. This layer represents a route, kind of like a GPS. Is there a function already implemented that allows me to do that, or I will need to make some additions to the app.js?

Thank you in advance

@slead
Copy link
Contributor

slead commented Apr 16, 2021

Hi Jim,

I don't think I've ever tried this, but a search for "leaflet auto refresh" brings up this post, which has some suggestions:

https://stackoverflow.com/questions/18515230/javascript-map-in-leaflet-how-to-refresh

I also found https://github.com/calvinmetcalf/leaflet-ajax which may be a good starting point?

Let me know if any of them work - and feel free to submit a Pull Request if you manage to get it working in Bootleaf!

Cheers,
Steve

@JimBratsos
Copy link
Author

Hey,

I figured out that the issue that I had was due to the usage of leaflet's ToC. Using your ajax call I can recreate the layer, but I have no clue as to how to update it and have leaflet's ToC to choose the layer of display at the same time. Do you have any ideas?

Thanks for your answer!

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