Learn R Programming

simplevis (version 6.0.0)

leaf_sf: Simple feature leaflet map.

Description

Map of simple features in leaflet that is not coloured.

Usage

leaf_sf(
  data,
  popup = TRUE,
  popup_vars_vctr = NULL,
  popup_numeric_format = function(x) prettyNum(x, big.mark = "", scientific = FALSE),
  popup_vars_rename = snakecase::to_sentence_case,
  pal = pal_viridis_reorder(1),
  size_point = 2,
  size_line = 2,
  alpha_point = NULL,
  alpha_line = NULL,
  alpha_fill = NULL,
  basemap = "light",
  layer_id_var = NULL,
  map_id = "map"
)

Arguments

data

An sf object of geometry type point/multipoint, linestring/multilinestring or polygon/multipolygon geometry type. Required input.

popup

TRUE or FALSE of whether to have a popup.

popup_vars_vctr

Vector of quoted variable names to include in the popup. If NULL, defaults to making a leafpop::popupTable of all columns.

popup_numeric_format

A function to format all numeric variables within the popup column. Defaults to non-scientific. Use function(x) x to leave as is.

popup_vars_rename

Function to rename column names for the popup. Defaults to snakecase::to_sentence_case. Use function(x) x to leave column names untransformed.

pal

Character vector of hex codes.

size_point

Size of points (i.e. radius). Defaults to 2.

size_line

Size of lines around features (i.e. weight). Defaults to 2.

alpha_point

The opacity of the points.

alpha_line

The opacity of the outline.

alpha_fill

The opacity of the fill.

basemap

The underlying basemap. Either "light", "dark", "satellite", "street", or "ocean". Defaults to "light". Only applicable where shiny equals FALSE.

layer_id_var

Unquoted variable to be used as a shiny id, such that in the event where a feature is clicked on, the applicable value of this is available as input$map_marker_click$id or input$map_shape_click$id.

map_id

The shiny map id for a leaflet map within a shiny app. Defaults to "map".

Value

A leaflet object.

Examples

Run this code
# NOT RUN {
leaf_sf(example_point)

leaf_sf(example_polygon)

# }

Run the code above in your browser using DataLab