table_leaflet: Leaflet interactive map for known locations

View source: R/table_leaflet.R

table_leafletR Documentation

Leaflet interactive map for known locations

Description

This function creates interactive maps that will be displayed in RStudio's 'Viewer' tab. The default setting of jitter will move locations randomly within an ~50 meter radius so that overlapping locations can be identified. Set jitter = 0 to see precise locations.

Usage

table_leaflet(
  locationTbl = NULL,
  maptype = c("terrain", "roadmap", "satellite", "toner"),
  extraVars = NULL,
  jitter = 5e-04,
  ...
)

Arguments

locationTbl

Tibble of known locations.

maptype

Optional name of leaflet ProviderTiles to use, e.g. terrain.

extraVars

Character vector of addition locationTbl column names to be shown in leaflet popups.

jitter

Amount to use to slightly adjust locations so that multiple monitors at the same location can be seen. Use zero or NA to see precise locations.

...

Additional arguments passed to leaflet::addCircleMarker().

Details

The maptype argument is mapped onto leaflet "ProviderTile" names. Current mappings include:

  • "roadmap" => "OpenStreetMap"

  • "satellite" => "Esri.WorldImagery"

  • "terrain" => "Esri.WorldTopoMap"

  • "toner" => "Stamen.Toner"

If a character string not listed above is provided, it will be used as the underlying map tile if available. See https://leaflet-extras.github.io/leaflet-providers/ for a list of "provider tiles" to use as the background map.

Value

A leaflet "plot" object which, if not assigned, is rendered in Rstudio's 'Viewer' tab.

Examples

## Not run: 
library(MazamaLocationUtils)

# A table with all core metadata
table_leaflet(wa_monitors_500)
  
# A table missing some core metadata
table_leaflet(
  wa_airfire_meta,
  extraVars = c("stateCode", "countyName", "msaName")
)

# Customizing the map
table_leaflet(
  wa_airfire_meta,
  extraVars = c("stateCode", "countyName", "msaName"),
  radius = 6,
  color = "black",
  weight = 2,
  fillColor = "red",
  fillOpacity = 0.3
)

## End(Not run)

MazamaLocationUtils documentation built on Sept. 11, 2024, 9:08 p.m.