# \donttest{
geoJson <- readr::read_file(
system.file(
"examples/data/geojson/crimes_by_district.topojson",
package = "leaflet.extras"
)
)
leaflet() %>%
addTiles() %>%
setView(-75.14, 40, 11) %>%
addBootstrapDependency() %>%
enableMeasurePath() %>%
addGeoJSONChoropleth(
geoJson,
valueProperty = "incidents",
scale = c("white", "red"),
mode = "q",
steps = 4,
padding = c(0.2, 0),
labelProperty = "location",
popupProperty = propstoHTMLTable(
props = c("dist_numc", "location", "incidents"),
table.attrs = list(class = "table table-striped table-bordered"),
drop.na = TRUE
),
color = "#ffffff", weight = 1, fillOpacity = 0.7,
highlightOptions = highlightOptions(
weight = 2, color = "#000000",
fillOpacity = 1, opacity = 1,
bringToFront = TRUE, sendToBack = TRUE
),
pathOptions = pathOptions(
showMeasurements = TRUE,
measurementOptions = measurePathOptions(imperial = TRUE)
)
)
# }
leaflet() %>%
addTiles() %>%
addCircles(lng = c(10, 20), lat = c(50, 60), group = "Group 1") %>%
addCircles(lng = c(15, 25), lat = c(55, 65), group = "Group 2") %>%
addMeasurePathToolbar(group = "Group 1") # Enable measurements for "Group 1" only
Run the code above in your browser using DataLab