This extension to Leaflet provides a very advanced API for adding controls to the Leaflet plot (so it won't clutter the Shiny widget sidebar) and fine-grained control and interaction with the animation, including frames per second, date-time handling, etc.
Tasks
[ ] Make note of the shape and characteristics of GeoJSON data that Leaflet.TimeDimension requires or supports; make special note of how flexible this is, given the shape of the incidence data we have (see the attachment) is very wide (not an optimal format, like tidy data)
[ ] Convert Ebola_Incidence_Data.xlsx to a GeoJSON format Leaflet.TimeDimension supports (see the notes)
[ ] Use the tooling and lessons learned in the previous task to write a robust, idiomatic R function (or family of interrelated functions) to convert suitably shaped user-supplied data to GeoJSON format, so that we can animate it
According to GeoJSON specification, geometry coordinates can have only three dimensions: latitude, longitude and elevation. There isn't a standard way to add time dimension information. This plugin will search for some attributes inside properties:
coordTimes, times or linestringTimestamps: array of times that can be associated with a geometry (datestrings or ms). In the case of a LineString, it must have as many items as coordinates in the LineString. (Note: coordTimes is the name of the property recently included at Mapbox toGeoJSON library)
Leaflet.TimeDimension
This extension to Leaflet provides a very advanced API for adding controls to the Leaflet plot (so it won't clutter the Shiny widget sidebar) and fine-grained control and interaction with the animation, including frames per second, date-time handling, etc.
Tasks
Notes
In this part of the Leaflet.TimeDimension API documentation, we read
Understanding this, we can use this dependency-free JavaScript tool, toGeoJSON, from Mapbox (very reputable group of developers, organized by the creator of Leaflet if I recall correctly) to reliably create GeoJSON from GPX files, which are an open and standardized format used for GPS data which does have a specification for including date time information. The remaining need is to convert the Incidence data we have stored in the attached XLSX file to a GPX format using whatever tooling is mentioned in this Appsilon blog, which accurately represents the latitude-longitude coordinate pairs and date-time information (recall the source projection, because that may be important in some stage of the conversion pipeline to GeoJSON [it is likely projected in WGS84]).