addScaleBar | R Documentation |
Uses Leaflet's built-in scale bar feature to add a scale bar.
addScaleBar(
map,
position = c("topright", "bottomright", "bottomleft", "topleft"),
options = scaleBarOptions()
)
scaleBarOptions(
maxWidth = 100,
metric = TRUE,
imperial = TRUE,
updateWhenIdle = TRUE
)
removeScaleBar(map)
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 |
maxWidth |
maximum width of the control in pixels (default 100) |
metric |
if |
imperial |
if |
updateWhenIdle |
if |
leaflet() %>%
addTiles() %>%
addScaleBar()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.