FOSS4G NA 2024

Fast, Organized Interactive Web Maps with R Shiny
09-11, 13:30–14:00 (America/Chicago), Grand G

This talk will consist of advice for newcomers on building web based mapping tools in R. A brief overview of the relevant R libraries will be followed by specific recommendations for optimizing map load speed and code organization.


This presentation is intended to teach programmers everything they need to know to get started building interactive web maps in R. R Shiny enables programmers to create web maps within the same environment they use for geoprocessing, making it an excellent choice for new programmers to begin with interactive data visualization. Additional, more complex, web mapping alternatives to R Shiny will also be touched upon in the session.

First, the presentation will cover the basics of creating a map using the R leaflet library. JavaScript libraries with more advanced visualization capabilities will also be presented: MapBox GL JS (via the MapDeck R library) and D3.js (via the r2d3 library). Examples of web maps built using each library from NORC’s VizStudio will be shown to demonstrate the benefits and drawbacks to each. Step by step programming instructions will be presented for one of the major trouble spots to new R programmers, how to pass spatial data from R to JavaScript.

Then, the presentation will cover best practices for building web maps in R Shiny. Organizational strategies for Shiny app code will be discussed, presenting the Golem library, and the ReactR library as alternatives to R Shiny’s native module syntax. Next, we will share techniques for improving map rendering speed, such as simplifying polygons, limiting how much HTML/SVG maps are generating, and determining appropriate levels of reactivity. Finally, we'll provide a brief overview of hosting options for Shiny apps, including AWS, Docker, and Posit solutions like positconnect and shinyapps.io.