leaf_sf: Simple feature leaflet map.

View source: R/leaf_sf.R

leaf_sfR Documentation

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_mix(1),
  size_point = 2,
  size_line = 2,
  alpha_point = NULL,
  alpha_line = NULL,
  alpha_fill = NULL,
  basemap = "light",
  layer_id_var = NULL,
  group_id = NULL,
  map_id = "leaf"
)

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 in shiny, so that in the event where a feature is clicked on, the value of this is returned for that feature (e.g. input$map_marker_click$id).

group_id

The id name for the sf group.

map_id

The map id for the leaflet map. Defaults to "leaf".

Value

A leaflet object.

Examples

## Not run: 
leaf_sf(example_point)

leaf_sf(example_polygon)

## End(Not run)


simplevis documentation built on May 31, 2023, 7:02 p.m.