Skip to content

Demonstrates adding groupedlayercontrol within R script producing leaflet map with exclusive groups and toggling multiple groups of layers.

Notifications You must be signed in to change notification settings

analytichealth/r-leaflet-groupedlayercontrol-example

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

r-leaflet-groupedlayercontrol-example

This R code demonstrates adding leaflet-groupedlayercontrol that extend layer grouping and selection. This provides a ton of flexibility in determining which layers are shown. Have a look at the output folder if you would like to view the interactive map in a browser without running code.

To output, I make use of htmlwidgets::saveWidget() which saves the leaflet map to HTML along with various supporting files. This makes it easy to throw the resulting map up on a web server.

Why groupedlayercontrol?

The leaflet-groupedlayercontrol add-on provides a nice solution for grouping overlay layers. You can:

  • Create exclusive group (handy for only showing just one choropleth overlay at a time,
  • Create multiple grouped layers.
  • Ability to have multiple group titles shown in the layer menu.
  • Able to toggle all group layers on or off with a single checkbox click.
  • Able to toggle individual layers on or off.

Screenshots

Closeup of the grouped layer control menu in this example map.

Screenshot showing part of map and layers selected.

About

Demonstrates adding groupedlayercontrol within R script producing leaflet map with exclusive groups and toggling multiple groups of layers.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 92.7%
  • JavaScript 6.1%
  • Other 1.2%