leaflet icon indicating copy to clipboard operation
leaflet copied to clipboard

[feature-request] leaflet-timeline

Open jebyrnes opened this issue 9 years ago • 14 comments

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.

jebyrnes avatar Jul 31 '15 18:07 jebyrnes

+1

ignacio82 avatar Jul 31 '15 18:07 ignacio82

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.

MilesMcBain avatar Feb 08 '16 12:02 MilesMcBain

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.

happyshows avatar Feb 03 '17 15:02 happyshows

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.

timelyportfolio avatar Feb 03 '17 15:02 timelyportfolio

@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.

jcheng5 avatar Feb 03 '17 15:02 jcheng5

@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 avatar Feb 03 '17 16:02 happyshows

@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.

timelyportfolio avatar Feb 03 '17 17:02 timelyportfolio

FWIW, I am going to add Timeline plugin to leaflet.extras, should be done soon (1-2 weeks).

bhaskarvk avatar Feb 03 '17 19:02 bhaskarvk

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 avatar Jan 04 '18 20:01 xhdong-umd

@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 avatar Feb 09 '18 15:02 bhaskarvk

@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.

AmyMikhail avatar Jul 05 '18 11:07 AmyMikhail

This feature would still be amazing to have in 2020!

lucharo avatar Aug 30 '20 16:08 lucharo

There's leaftime on Cran

https://cran.r-project.org/web/packages/leaftime/index.html

tim-salabim avatar Aug 30 '20 17:08 tim-salabim