Open jebyrnes opened 9 years ago
+1
Due to Shiny support you can build something functionally identical to the earthquake example on the linked repo in Shiny using a sliderInput with animation enabled, and an observer that updates the map using the leafletProxy when sliderInput changes.
shiny sliderinput is not a good workaround as it triggers the redraw of entire leaflet map. It's difficult to track what's happening with the frequent refresh. Also, it may have performance implications when there are too many points on the map while the change may be just removing one point at a certain interval.
for reference here is a proof of concept http://stackoverflow.com/questions/36554605/cant-loop-with-rs-leaflet-package-to-produce-multiple-maps/36587525#36587525. We could also explore shiny slider with a leaflet proxy as a more flexible alternative, since this would allow for non-time dimensions.
@happyshows @timelyportfolio Exactly, I was going to suggest leafletProxy. This pattern is powerful enough (a single layer or group being independently reactive) that it might be worth wrapping up into a friendly API somehow.
@timelyportfolio I tried to run the example code but not seeing any animation or control component in chrome. Could you rerun it and see if it's the same on your side?
@happyshows, the leaflet
on R side has changed. I updated to work with newest https://gist.github.com/timelyportfolio/6119de4db34da4065832396c4bb9ea93. It works now in RStudio Viewer also, but I still think the proxy solution will be much better. If we are just dealing with circle markers, we could easily use crosstalk
also.
FWIW, I am going to add Timeline plugin to leaflet.extras, should be done soon (1-2 weeks).
Hi @bhaskarvk , our shiny app used leaflet map and would like to have some animations on animal tracking data. A timeline plugin or other plugin listed in Temporal Viz support will be very helpful.
I totally understand you must have a lot of work other than this project, though do you have an estimate of progress on timeline or other temporal Viz plugin?
@xhdong-umd I am fairly busy with day job for Q1 2018. Any progress on leaflet-extras and leaflet development on my part will have to wait till Q2.
@bhaskarvk and all, also interested in this development but thought to add some points for practical implication: I have tried implementing @timelyportfolio ' s solution on one of my own maps and one difficulty is that I had already defined how the points should appear using the standard r leaflet syntax - whereas the implementation of this plugin requires the appearance/formatting of the points to be defined inside the Java script (and I don't know Java, so not sure how to edit this).
Hopefully when this is implemented in the leaflet package, it would be something like addTimeSlider(mydata$dates)
in a layer and this would be applied to points that had been defined previously?
Also - would be good to have optional display of labels on the slider, with the ability to choose between date / weeks with/without year / months with/without year / years for example. I note that @timelyportfolio 's implementation just puts the full date including timezone on the left-hand side of the slider, would be good to have options for where to display this label as well (left/right/top/bottom) and similar options for where on the map to place the slider.
This feature would still be amazing to have in 2020!
There's leaftime on Cran
leaflet.extras2 offers
See https://github.com/skeate/Leaflet.timeline
This would be an incredibly powerful way to visualize spatio-temporal data. Just saw this and thought I'd throw it out as a pie-in-the-sky.