powered by
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)
scaleBarOptions( maxWidth = 100, metric = TRUE, imperial = TRUE, updateWhenIdle = TRUE )
removeScaleBar(map)
the map to add the scale bar to
position of control: "topleft", "topright", "bottomleft", or "bottomright"
a list of additional options, intended to be provided by a call to scaleBarOptions
scaleBarOptions
maximum width of the control in pixels (default 100)
if TRUE (the default), show a scale bar in metric units (m/km)
TRUE
if TRUE (the default), show a scale bar in imperial units (ft/mi)
if FALSE (the default), the scale bar is always up-to-date (updated on move). If TRUE, the control is updated on moveend.
FALSE
move
moveend
# \donttest{ leaflet() %>% addTiles() %>% addScaleBar() # }
Run the code above in your browser using DataLab