Powering Turing Geovisualization Engine with R

eRum 2020

Layik Hama

2020-06-17

Intro

  • Institutions: Leeds Institute for Data Analytics & Turing Institute

  • Project: Dr. Nik Lomax and Dr. Roger Beecham

  • Research Theme: Urban Analytics, Sir Alan Wilson and Prof Mark Birkin.

  • May 2019 - Oct 2020

  • More geo-visualization than research engineering or engineering research.

Talk Overview

A damaged Graphics Processing Unit (GPU) 104290923_2519668941677516_7302972911295968679_n

  • Data visualization which means graphics which means using CPU and/or GPU
    • Ubiquitous (Lyytinen and Yoo 2002)
    • Interactive (Benyon 2014)
      • design, technology, people, activities
  • R doing what it does (best?): data analysis
  • Turing Geo-visualization Engine (TGVE)

What is an eAtlas?

What is an eatlas?

  • Feature extraction? Beautiful pictures?
  • Data exploration/interrogation to draw insights
  • Combining different datasets
  • Decision making and public engagement tool

Why R

  • One of two choices (Python which I would have preferred) both being Open Source
    • Being Open Source not so fancy any more?
  • Colleagues who use R around University of Leeds.
  • Focus on Grammar of Graphics (Wilkinson 2005) and other academic excellence such as ggplot2 (Wickham 2016)
  • That also means a great set of tools
  • You might have better reasons.

Graphics R v Web

GPU/CPU Graphics

Graphics R v Web (2)

Web Tech, Python and R

Graphics in R

  • R functions:
    • library(help = “grDevices”)
    • x11()
    • quartz()
    • etc from (Hiebeler 2015)
  • grid package is base R.
  • Not interactive
  • Not as widely available as the browser.

Mastering Software Development in R

Screenshot from (Meinicke et al. 2017)

R & React

React is a JavaScript library which generates “HTML + CSS” languages on scholar languages on stackoverflow

R web applications

Shiny v rPlumber Shiny v rPlumber

Web mapping (Xerox)

xerox map on netscape

Web mapping (now)

web mapping libraries

Web mapping (now)

web mapping libraries

Turing Geo-Visualization Engine (TGVE or eAtlas)

Turing eAtlas screenshot

R & React (geo)

# `geoplumber` is still not on CRAN!
library(geoplumber)
# view a dataset such as the `traffic` sf object bundled 
t <- gp_map(geoplumber::traffic, browse_map = FALSE,
            height = "320px", width = "90%")
# use includeHTML for markdown
htmltools::includeHTML(t)
geoplumber | output

R & React (JavaScript)

# p <- tolower(file.path(tempdir(), "gp"))
# gp_build()
p <- "~/code/geoplumber/my-app/"
ow <- setwd(p)
r <- gp_explore()
r$kill()
setwd(ow)
  • R does NOT do “essential” UI, only pipeline work
  • Sweet spot of decoupling?

R & React (code)

# add component
  parent <- add_lines(
    parent,   # target
    "<Route", # pattern
    c(        # what
      # <Route exact path="/" component={
      paste0('<Route exact path="/explore" component={'),
      paste0('() => <Eatlas defaultURL="http://localhost:8000', endpoint,'"/>'),
      '}/>'
    )
  )
# finally write before building
  write(parent, "src/App.js")
  # build & serve
  if(run) {
    # TODO: if already installed skip
    gp_install_npm_package(tolower(component.name))
    if(build) {
      # TODO: gp_build is not made for this or refactor it
      gp_build()
    }
    ...

Alex - shiny code

R & React (TGVE)

Turing Geo-visualization Engine in geoplumber: gp_explore

TGVE

TGVE

Components of TGVE

Turing TGVE

Front-end: under the hood

Minimise CPU time rendering pipeline
cpu gpu comparison reactive model Slides from Uber Engineering DeckGL tea: shorturl.at/anKR5

More R & React

MS SandDance

The world of vis

IEEEVIS 2019

COVID19 application

covid19 covid19

Heavily customised code base of the project source code.

Conclusion

  • TGVE is powered by R although rendering is routed via web technologies.
  • R does what it does best and so does JS
  • The full stack of technologies is there to develop a scalable engine to visualize geospatial data
  • R already has the required wrapper packages to take this further to another level (think skimr)
  • Send the instructions to browser only once, subsequently just wire the data.

Thank you

  • www.turing.ac.uk/research/research-projects/turing-geovisualization-engine
  • repo home: www.github.com/layik/eAtlas
  • COVID19 showcase www.geoplumber.com

graph vis

References

Benyon, David. 2014. “Designing Interactive Systems: A Comprehensive Guide to Hci, Ux and Interaction Design.”

Hiebeler, David E. 2015. R and Matlab. CRC Press.

Lyytinen, Kalle, and Youngjin Yoo. 2002. “Ubiquitous Computing.” Communications of the ACM 45 (12): 63–96.

Meinicke, Jens, Thomas Thüm, Reimar Schröter, Fabian Benduhn, Thomas Leich, and Gunter Saake. 2017. Mastering Software Variability with Featureide. Springer.

Wickham, Hadley. 2016. Ggplot2: Elegant Graphics for Data Analysis. Springer.

Wilkinson, Leland. 2005. “Guides.” The Grammar of Graphics, 347–56.