ashokkrish / spatialEpisim

spatialEpisim: Spatial Tracking of Infectious Disease Epidemics using Mathematical Models
GNU General Public License v3.0
9 stars 4 forks source link

Replace the "transmissionPath" animation with Leaflet.TimeDimension #44

Closed bryce-carson closed 3 months ago

bryce-carson commented 3 months ago

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

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)

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]).

bryce-carson commented 3 months ago

7 and #11 could be resolved using Leaflet.TimeDimension as well.