cesium: R interface to cesium.js virtual globe - rstats-gsoc/gsoc2016 GitHub Wiki
Background
Space-time data analysis is becoming ever more popular and increasingly important. Examples of such analyses include animal movements, wind trajectories and customer movements. The spacetime
package provides classes and methods for spatio-temporal data analysis and package 'trajectories' enables trajectory and movement analyses. However, up to now these packages only provide static visualization solutions, which, given the dynamic nature of space time data, is not optimal. The htmlwidgets
package provides a solid framework for connecting R to interactive JavaScript libraries. Regarding spatial data, RStudio's leaflet
package is an example of such a solution that has been very successful. However, it does, as of now, not offer any temporal component to the visual rendering of spatial data (even though plugins for time sliders exist on the leaflet.js side, but if and when they will be integrated into the leaflet package remains to be seen). The only package so far that supports spacetime
data classes is library(plotKML)
which provides access to Google Earth. Similar to Google earth, the JavaScript library cesium.js offers a mature solution for visualizing data in 3.5 dimensions (2.5D + time). Therefore, we aim at creating an R package that brings the capabilities of cesium.js to R. The general design should be similar to that of the leaflet
package to provide a highly flexible, yet user-friendly package without relying on external software (other than processing libraries) as in the case of plotKML
.
NOTE: students will need to have advanced knowledge of both R and JavaScript to be able to implement this project.
Related work
- see the CRAN task view on the analysis of spatial data in R.
- RStudio's leaflet package
- mapview provides a user-friendly wrapper around
leaflet
- plotKML
Details of the project
The aims of this 3-month project include:
- Extending the existing implementation of cesium.js in R (NOTE: so far this has only been tested under Ubuntu 14.04).
- Implementing functionality that enables the rendering/piping of spatio-temporal R objects (from
library(spacetime)
) in the browser or RStudio viewer. E.g.cesium()
,addLayer()
,addBasemap()
,animateTime()
- Implementing the rendering/passing of standard spatial objects provided by
library(sp)
andlibrary(raster)
. - Documentating the package code, using
roxygen2
. - Implementing a syntax similar to that of package
leaflet
so users can easily switch between the two.
Expected impact
Visual inspection of spatial and spatio-temporal data are, unlike in other purely statistical fields, an integral component of the spatial analysis work-flow. Enabling dynamic viewing capabilities for space-time data will therefore provide enhanced analytical capabilities and will also immensely aid the presentation of such data. Furthermore, avoiding the reliance on third party software will enhance and simplify usability.
Mentors
Tests
- Easy: Fork the above mentioned
library(cesium)
and implement theBaseLayerPicker
. The minimum requirement would be to be able to switch between at least two base layers (though ideally all of the ones used in the standard example at http://cesiumjs.org/index.html (click on 'Tap to interact'). Documentation for the BaseLayerPicker can be found here - Medium: Additionally, implement the parsing of a standard
SpatialPointsDataFrame
so that this can be visualized on the globe. For this you should use themeuse
data set fromlibrary(sp)
. The minimum solution would be a function call such asshowPoints(x)
which visualizes the locations of all points of x (where x is the meuseSpatialPointsDataFrame
). This means that it is fine to hard code everything else, though additional function arguments like the coloring or size of the points would be desirable. Note: it is sufficient to show the locations of the points only, i.e. no additional information needs to be displayed (see below for a more advanced task). - Hard: Here you have two options:
- Extend the medium task so that all attributes of the points are visualized via popups. This means that when the user clicks on a point the values of all columns of the particular point are shown in a standard cesium popup window. For an example of this have a look at this real-time satellite tracking example. Note: it is not required to implement the option to focus on a particular point (the little camera icon at the top left of the popup window). It is sufficient for the popup to contain the attribute information.
- Implement a
shiny
app that allows users to display any of the attributes (columns) of themeuse
data set on the cesium globe. The minimum requirement for this task is that the user should be provided with a drop-down menu to select which column to display. Additional tweaking of arguments such as color, size etc. would again be desirable.
Solutions of tests
Students, please post a link to your test results here.