addScaleBar: Add or remove a scale bar

Description Usage Arguments Examples

View source: R/scalebar.R

Description

Uses Leaflet's built-in scale bar feature to add a scale bar.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
addScaleBar(
  map,
  position = c("topright", "bottomright", "bottomleft", "topleft"),
  options = scaleBarOptions()
)

scaleBarOptions(
  maxWidth = 100,
  metric = TRUE,
  imperial = TRUE,
  updateWhenIdle = TRUE
)

removeScaleBar(map)

Arguments

map

the map to add the scale bar to

position

position of control: "topleft", "topright", "bottomleft", or "bottomright"

options

a list of additional options, intended to be provided by a call to scaleBarOptions

maxWidth

maximum width of the control in pixels (default 100)

metric

if TRUE (the default), show a scale bar in metric units (m/km)

imperial

if TRUE (the default), show a scale bar in imperial units (ft/mi)

updateWhenIdle

if FALSE (the default), the scale bar is always up-to-date (updated on move). If TRUE, the control is updated on moveend.

Examples

1
2
3

leaflet documentation built on Jan. 7, 2021, 9:08 a.m.