From 08f3e14961321639a4eeee124bcafa26f69f6c2b Mon Sep 17 00:00:00 2001 From: trafficonese Date: Sun, 1 Sep 2024 21:57:30 +0000 Subject: [PATCH] Update documentation --- DESCRIPTION | 2 +- man/addBuildings.Rd | 2 +- man/addClusterCharts.Rd | 74 ++++++++++++++++++-------------- man/addContextmenu.Rd | 44 +++++++++++--------- man/addDivicon.Rd | 39 +++++++++-------- man/addEasyprint.Rd | 9 ++-- man/addGIBS.Rd | 10 +++-- man/addHeightgraph.Rd | 10 +++-- man/addHexbin.Rd | 20 +++++---- man/addHistory.Rd | 2 +- man/addLabelgun.Rd | 10 +++-- man/addMapkeyMarkers.Rd | 20 +++++---- man/addMovingMarker.Rd | 29 ++++++++----- man/addOpenweatherCurrent.Rd | 10 +++-- man/addOpenweatherTiles.Rd | 7 ++-- man/addPlayback.Rd | 81 +++++++++++++++++++++--------------- man/addReachability.Rd | 2 +- man/addSidebar.Rd | 12 ++++-- man/addSidebyside.Rd | 36 ++++++++++------ man/addSpinner.Rd | 2 +- man/addTangram.Rd | 6 ++- man/addTimeslider.Rd | 20 +++++---- man/addVelocity.Rd | 4 +- man/addWMS.Rd | 22 ++++++---- man/easyprintMap.Rd | 48 ++++++++++----------- man/historyOptions.Rd | 9 ++-- man/makeMapkeyIcon.Rd | 12 +++--- man/mapkeyIconList.Rd | 2 +- man/mapkeyIcons.Rd | 15 ++++--- man/setBuildingStyle.Rd | 2 +- man/sidebar_tabs.Rd | 12 ++++-- man/updateBuildingTime.Rd | 2 +- man/velocityOptions.Rd | 3 +- 33 files changed, 336 insertions(+), 242 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 31a58752..4aa34c4a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -33,4 +33,4 @@ Suggests: curl URL: https://trafficonese.github.io/leaflet.extras2/, https://github.com/trafficonese/leaflet.extras2 BugReports: https://github.com/trafficonese/leaflet.extras2/issues -RoxygenNote: 7.3.1 +RoxygenNote: 7.3.2 diff --git a/man/addBuildings.Rd b/man/addBuildings.Rd index 9027a2cd..7aec8839 100644 --- a/man/addBuildings.Rd +++ b/man/addBuildings.Rd @@ -49,7 +49,7 @@ See the OSM Wiki: \href{https://wiki.openstreetmap.org/wiki/Simple_3D_Buildings} library(leaflet) library(leaflet.extras2) -leaflet() \%>\% +leaflet() \%>\% addProviderTiles("CartoDB") \%>\% addBuildings(group = "Buildings") \%>\% addLayersControl(overlayGroups = "Buildings") \%>\% diff --git a/man/addClusterCharts.Rd b/man/addClusterCharts.Rd index 4b15b2a6..52e151df 100644 --- a/man/addClusterCharts.Rd +++ b/man/addClusterCharts.Rd @@ -111,31 +111,38 @@ data$category <- sample(categories, size = nrow(data), replace = TRUE) leaflet() \%>\% addProviderTiles("CartoDB.Positron") \%>\% leaflet::addLayersControl(overlayGroups = "clustermarkers") \%>\% - addClusterCharts(data = data - , categoryField = "category" - , categoryMap = data.frame(labels = categories, - colors = c("#F88", "#FA0", "#FF3", "#BFB"), - strokes = "gray") - , group = "clustermarkers" - , popupFields = c("brewery", "address", "zipcode", "category") - , popupLabels = c("Brauerei", "Adresse", "PLZ", "Art") - , label = "brewery" + addClusterCharts( + data = data, + categoryField = "category", + categoryMap = data.frame( + labels = categories, + colors = c("#F88", "#FA0", "#FF3", "#BFB"), + strokes = "gray" + ), + group = "clustermarkers", + popupFields = c("brewery", "address", "zipcode", "category"), + popupLabels = c("Brauerei", "Adresse", "PLZ", "Art"), + label = "brewery" ) ## Bar Chart leaflet() \%>\% addProviderTiles("CartoDB.Positron") \%>\% leaflet::addLayersControl(overlayGroups = "clustermarkers") \%>\% - addClusterCharts(data = data - , type = "bar" - , categoryField = "category" - , categoryMap = data.frame(labels = categories, - colors = c("#F88", "#FA0", "#FF3", "#BFB"), - strokes = "gray") - , group = "clustermarkers" - , popupFields = c("brewery", "address", "zipcode", "category") - , popupLabels = c("Brauerei", "Adresse", "PLZ", "Art") - , label = "brewery") + addClusterCharts( + data = data, + type = "bar", + categoryField = "category", + categoryMap = data.frame( + labels = categories, + colors = c("#F88", "#FA0", "#FF3", "#BFB"), + strokes = "gray" + ), + group = "clustermarkers", + popupFields = c("brewery", "address", "zipcode", "category"), + popupLabels = c("Brauerei", "Adresse", "PLZ", "Art"), + label = "brewery" + ) ## Custom Pie Chart with "mean" aggregation on column "value" data <- sf::st_as_sf(breweries91) @@ -146,19 +153,22 @@ data$value <- round(runif(nrow(data), 0, 100), 0) leaflet() \%>\% addProviderTiles("CartoDB.Positron") \%>\% leaflet::addLayersControl(overlayGroups = "clustermarkers") \%>\% - addClusterCharts(data = data - , type = "custom" - , valueField = "value" - , aggregation = "mean" - , categoryField = "category" - , categoryMap = data.frame(labels = categories, - colors = c("#F88", "#FA0", "#FF3", "#BFB"), - strokes = "gray") - , options = clusterchartOptions(rmax=50, digits=0, innerRadius = 20) - , group = "clustermarkers" - , popupFields = c("brewery", "address", "zipcode", "category","value") - , popupLabels = c("Brauerei", "Adresse", "PLZ", "Art", "Value") - , label = "brewery" + addClusterCharts( + data = data, + type = "custom", + valueField = "value", + aggregation = "mean", + categoryField = "category", + categoryMap = data.frame( + labels = categories, + colors = c("#F88", "#FA0", "#FF3", "#BFB"), + strokes = "gray" + ), + options = clusterchartOptions(rmax = 50, digits = 0, innerRadius = 20), + group = "clustermarkers", + popupFields = c("brewery", "address", "zipcode", "category", "value"), + popupLabels = c("Brauerei", "Adresse", "PLZ", "Art", "Value"), + label = "brewery" ) ## For Shiny examples, please run: diff --git a/man/addContextmenu.Rd b/man/addContextmenu.Rd index cb58fb39..92df003f 100644 --- a/man/addContextmenu.Rd +++ b/man/addContextmenu.Rd @@ -49,27 +49,33 @@ If the selected contextmenu item is triggered from: \examples{ library(leaflet) leaflet(options = leafletOptions( - contextmenu = TRUE, - contextmenuWidth = 200, - contextmenuItems = - context_mapmenuItems( - context_menuItem("Zoom Out", "function(e) {this.zoomOut()}", disabled=FALSE), - "-", - context_menuItem("Zoom In", "function(e) {this.zoomIn()}")))) \%>\% + contextmenu = TRUE, + contextmenuWidth = 200, + contextmenuItems = + context_mapmenuItems( + context_menuItem("Zoom Out", "function(e) {this.zoomOut()}", disabled = FALSE), + "-", + context_menuItem("Zoom In", "function(e) {this.zoomIn()}") + ) +)) \%>\% addTiles(group = "base") \%>\% addContextmenu() \%>\% - addMarkers(data = breweries91, label = ~brewery, - layerId = ~founded, group = "marker", - options = markerOptions( - contextmenu = TRUE, - contextmenuWidth = 200, - contextmenuItems = - context_markermenuItems( - context_menuItem(text = "Show Marker Coords", - callback = "function(e) {alert(e.latlng);}", - index = 1) - ) - )) + addMarkers( + data = breweries91, label = ~brewery, + layerId = ~founded, group = "marker", + options = markerOptions( + contextmenu = TRUE, + contextmenuWidth = 200, + contextmenuItems = + context_markermenuItems( + context_menuItem( + text = "Show Marker Coords", + callback = "function(e) {alert(e.latlng);}", + index = 1 + ) + ) + ) + ) } \references{ diff --git a/man/addDivicon.Rd b/man/addDivicon.Rd index 3fe99f4f..32f7c1d8 100644 --- a/man/addDivicon.Rd +++ b/man/addDivicon.Rd @@ -92,27 +92,30 @@ library(leaflet.extras2) # Sample data df <- sf::st_as_sf(atlStorms2005) df <- suppressWarnings(st_cast(df, "POINT")) -df <- df[sample(1:nrow(df), 50, replace = FALSE),] -df$classes = sample(x = c("myclass1","myclass2","myclass3"), nrow(df), replace = TRUE) +df <- df[sample(1:nrow(df), 50, replace = FALSE), ] +df$classes <- sample(x = c("myclass1", "myclass2", "myclass3"), nrow(df), replace = TRUE) df$ID <- paste0("ID_", 1:nrow(df)) -leaflet() \%>\% +leaflet() \%>\% addTiles() \%>\% - addDivicon(data = df - , html = ~paste0( - '
', - '
', Name, '
', - '
MaxWind: ', MaxWind, '
', - '
' - ) - , label = ~Name - , layerId = ~ID - , group = "Divicons" - , popup = ~paste("ID: ", ID, "
", - "Name: ", Name, "
", - "MaxWind:", MaxWind, "
", - "MinPress:", MinPress) - , options = markerOptions(draggable = TRUE) + addDivicon( + data = df, + html = ~ paste0( + '
', + '
', Name, "
", + '
MaxWind: ', MaxWind, "
", + "
" + ), + label = ~Name, + layerId = ~ID, + group = "Divicons", + popup = ~ paste( + "ID: ", ID, "
", + "Name: ", Name, "
", + "MaxWind:", MaxWind, "
", + "MinPress:", MinPress + ), + options = markerOptions(draggable = TRUE) ) } \concept{DivIcon Functions} diff --git a/man/addEasyprint.Rd b/man/addEasyprint.Rd index ca80f693..45d60229 100644 --- a/man/addEasyprint.Rd +++ b/man/addEasyprint.Rd @@ -19,12 +19,13 @@ Add a control, which allows to print or export a map as .PNG. } \examples{ library(leaflet) -leaflet() \%>\% +leaflet() \%>\% addTiles() \%>\% addEasyprint(options = easyprintOptions( - title = 'Print map', - position = 'bottomleft', - exportOnly = TRUE)) + title = "Print map", + position = "bottomleft", + exportOnly = TRUE + )) } \references{ \url{https://github.com/rowanwins/leaflet-easyPrint} diff --git a/man/addGIBS.Rd b/man/addGIBS.Rd index ba72d9ae..2f7a6f04 100644 --- a/man/addGIBS.Rd +++ b/man/addGIBS.Rd @@ -47,12 +47,14 @@ library(leaflet.extras2) layers <- gibs_layers$title[c(35, 128, 185)] -leaflet() \%>\% +leaflet() \%>\% addTiles() \%>\% setView(9, 50, 4) \%>\% - addGIBS(layers = layers, - dates = Sys.Date() - 1, - group = layers) \%>\% + addGIBS( + layers = layers, + dates = Sys.Date() - 1, + group = layers + ) \%>\% addLayersControl(overlayGroups = layers) } \references{ diff --git a/man/addHeightgraph.Rd b/man/addHeightgraph.Rd index 866aeb3b..ec72689f 100644 --- a/man/addHeightgraph.Rd +++ b/man/addHeightgraph.Rd @@ -81,7 +81,7 @@ library(leaflet) library(leaflet.extras2) library(sf) -data <- st_cast(st_as_sf(leaflet::atlStorms2005[4,]), "LINESTRING") +data <- st_cast(st_as_sf(leaflet::atlStorms2005[4, ]), "LINESTRING") data <- st_transform(data, 4326) data <- data.frame(st_coordinates(data)) data$elev <- round(runif(nrow(data), 10, 500), 2) @@ -98,9 +98,11 @@ data$popup <- apply(data, 1, function(x) { leaflet() \%>\% addTiles(group = "base") \%>\% - addHeightgraph(color = "red", columns = c("steepness", "suitability"), - opacity = 1, data = data, group = "heightgraph", - options = heightgraphOptions(width = 400)) + addHeightgraph( + color = "red", columns = c("steepness", "suitability"), + opacity = 1, data = data, group = "heightgraph", + options = heightgraphOptions(width = 400) + ) } \references{ \url{https://github.com/GIScience/Leaflet.Heightgraph} diff --git a/man/addHexbin.Rd b/man/addHexbin.Rd index c31cc064..ac7538a3 100644 --- a/man/addHexbin.Rd +++ b/man/addHexbin.Rd @@ -63,16 +63,20 @@ library(leaflet) library(leaflet.extras2) n <- 1000 -df <- data.frame(lat = rnorm(n, 42.0285, .01), - lng = rnorm(n, -93.65, .01)) +df <- data.frame( + lat = rnorm(n, 42.0285, .01), + lng = rnorm(n, -93.65, .01) +) -leaflet() \%>\% +leaflet() \%>\% addTiles() \%>\% - addHexbin(lng = df$lng, lat = df$lat, - options = hexbinOptions( - colorRange = c("red", "yellow", "blue"), - radiusRange = c(10, 20) - )) + addHexbin( + lng = df$lng, lat = df$lat, + options = hexbinOptions( + colorRange = c("red", "yellow", "blue"), + radiusRange = c(10, 20) + ) + ) } \references{ \url{https://github.com/bluehalo/leaflet-d3#hexbins-api} diff --git a/man/addHistory.Rd b/man/addHistory.Rd index 4853dc2f..e2d23ea0 100644 --- a/man/addHistory.Rd +++ b/man/addHistory.Rd @@ -22,7 +22,7 @@ browser. By default, it is a simple pair of buttons -- back and forward. } \examples{ library(leaflet) -leaflet() \%>\% +leaflet() \%>\% addTiles() \%>\% addHistory() } diff --git a/man/addLabelgun.Rd b/man/addLabelgun.Rd index 4fbb9b58..e6b89fca 100644 --- a/man/addLabelgun.Rd +++ b/man/addLabelgun.Rd @@ -40,10 +40,12 @@ library(leaflet.extras2) leaflet() \%>\% addTiles() \%>\% - addMarkers(data = breweries91, - label = ~brewery, - group = "markers", - labelOptions = labelOptions(permanent = TRUE)) \%>\% + addMarkers( + data = breweries91, + label = ~brewery, + group = "markers", + labelOptions = labelOptions(permanent = TRUE) + ) \%>\% addLabelgun("markers", 1) } \references{ diff --git a/man/addMapkeyMarkers.Rd b/man/addMapkeyMarkers.Rd index 513ff7ca..cf097a88 100644 --- a/man/addMapkeyMarkers.Rd +++ b/man/addMapkeyMarkers.Rd @@ -78,15 +78,19 @@ Add Mapkey Markers \examples{ library(leaflet) -leaflet() \%>\% +leaflet() \%>\% addTiles() \%>\% - addMapkeyMarkers(data = breweries91, - icon = makeMapkeyIcon(icon = "mapkey", - iconSize = 30, - boxShadow = FALSE, - background = "transparent"), - group = "mapkey", - label = ~state, popup = ~village) + addMapkeyMarkers( + data = breweries91, + icon = makeMapkeyIcon( + icon = "mapkey", + iconSize = 30, + boxShadow = FALSE, + background = "transparent" + ), + group = "mapkey", + label = ~state, popup = ~village + ) } \references{ \url{https://github.com/mapshakers/leaflet-mapkey-icon} diff --git a/man/addMovingMarker.Rd b/man/addMovingMarker.Rd index 37bb5a1b..1facd689 100644 --- a/man/addMovingMarker.Rd +++ b/man/addMovingMarker.Rd @@ -82,20 +82,27 @@ library(sf) library(leaflet) library(leaflet.extras2) -crds <- data.frame(structure(c(-67.5, -68.5, -69.6, -70.5, -71.3, -72.2, -72.7, - -72.9, -73, -72.4, -70.8, 15.8, 16.5, 17.3, 17.8, 18.3, 18.6, - 19.8, 21.6, 23.5, 25.1, 27.9, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), - dim = c(11L, 3L), dimnames = list(NULL, c("X", "Y", "L1")))) -df <- st_sf(st_sfc(st_linestring(as.matrix(crds), dim="XYZ"), crs = 4326)) -st_geometry(df) <- "geometry"; df <- st_zm(df) +crds <- data.frame(structure( + c( + -67.5, -68.5, -69.6, -70.5, -71.3, -72.2, -72.7, + -72.9, -73, -72.4, -70.8, 15.8, 16.5, 17.3, 17.8, 18.3, 18.6, + 19.8, 21.6, 23.5, 25.1, 27.9, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + ), + dim = c(11L, 3L), dimnames = list(NULL, c("X", "Y", "L1")) +)) +df <- st_sf(st_sfc(st_linestring(as.matrix(crds), dim = "XYZ"), crs = 4326)) +st_geometry(df) <- "geometry" +df <- st_zm(df) -leaflet() \%>\% +leaflet() \%>\% addTiles() \%>\% addPolylines(data = df) \%>\% - addMovingMarker(data = df, - movingOptions = movingMarkerOptions(autostart = TRUE, loop = TRUE), - label="I am a pirate!", - popup="Arrr") + addMovingMarker( + data = df, + movingOptions = movingMarkerOptions(autostart = TRUE, loop = TRUE), + label = "I am a pirate!", + popup = "Arrr" + ) } \references{ \url{https://github.com/ewoken/Leaflet.MovingMarker} diff --git a/man/addOpenweatherCurrent.Rd b/man/addOpenweatherCurrent.Rd index 5b841510..5f2ca2d6 100644 --- a/man/addOpenweatherCurrent.Rd +++ b/man/addOpenweatherCurrent.Rd @@ -44,12 +44,14 @@ and if used in Shiny, a click on an icon will update a Shiny input at library(leaflet) library(leaflet.extras2) -Sys.setenv("OPENWEATHERMAP" = 'Your_API_Key') +Sys.setenv("OPENWEATHERMAP" = "Your_API_Key") -leaflet() \%>\% - addTiles() \%>\% setView(9, 50, 9) \%>\% +leaflet() \%>\% + addTiles() \%>\% + setView(9, 50, 9) \%>\% addOpenweatherCurrent(options = openweatherCurrentOptions( - lang = "en", popup = TRUE)) + lang = "en", popup = TRUE + )) } } \references{ diff --git a/man/addOpenweatherTiles.Rd b/man/addOpenweatherTiles.Rd index 9540810f..7b9d8d65 100644 --- a/man/addOpenweatherTiles.Rd +++ b/man/addOpenweatherTiles.Rd @@ -52,10 +52,11 @@ Out of the box a legend image is only available for Pressure, library(leaflet) library(leaflet.extras2) -Sys.setenv("OPENWEATHERMAP" = 'Your_API_Key') +Sys.setenv("OPENWEATHERMAP" = "Your_API_Key") -leaflet() \%>\% - addTiles() \%>\% setView(9, 50, 6) \%>\% +leaflet() \%>\% + addTiles() \%>\% + setView(9, 50, 6) \%>\% addOpenweatherTiles(layers = "wind") } } diff --git a/man/addPlayback.Rd b/man/addPlayback.Rd index 00c4521d..db8e5f3e 100644 --- a/man/addPlayback.Rd +++ b/man/addPlayback.Rd @@ -68,56 +68,71 @@ library(leaflet.extras2) library(sf) ## Single Elements -data <- sf::st_as_sf(leaflet::atlStorms2005[1,]) +data <- sf::st_as_sf(leaflet::atlStorms2005[1, ]) data <- st_cast(data, "POINT") -data$time = as.POSIXct( - seq.POSIXt(Sys.time() - 1000, Sys.time(), length.out = nrow(data))) +data$time <- as.POSIXct( + seq.POSIXt(Sys.time() - 1000, Sys.time(), length.out = nrow(data)) +) data$label <- as.character(data$time) leaflet() \%>\% addTiles() \%>\% - addPlayback(data = data, label = ~label, - popup = ~sprintf("I am a popup for \%s and \%s", - Name, label), - popupOptions = popupOptions(offset = c(0, -35)), - options = playbackOptions(radius = 3, - tickLen = 36000, - speed = 50, - maxInterpolationTime = 1000), - pathOpts = pathOptions(weight = 5)) + addPlayback( + data = data, label = ~label, + popup = ~ sprintf( + "I am a popup for \%s and \%s", + Name, label + ), + popupOptions = popupOptions(offset = c(0, -35)), + options = playbackOptions( + radius = 3, + tickLen = 36000, + speed = 50, + maxInterpolationTime = 1000 + ), + pathOpts = pathOptions(weight = 5) + ) ## Multiple Elements -data <- sf::st_as_sf(leaflet::atlStorms2005[1:5,]) +data <- sf::st_as_sf(leaflet::atlStorms2005[1:5, ]) data$Name <- as.character(data$Name) data <- st_cast(data, "POINT") data$time <- unlist(lapply(rle(data$Name)$lengths, function(x) { - seq.POSIXt(as.POSIXct(Sys.Date()-2), as.POSIXct(Sys.Date()), length.out = x) + seq.POSIXt(as.POSIXct(Sys.Date() - 2), as.POSIXct(Sys.Date()), length.out = x) })) -data$time <- as.POSIXct(data$time, origin="1970-01-01") +data$time <- as.POSIXct(data$time, origin = "1970-01-01") data$label <- paste0("Time: ", data$time) -data$popup = sprintf("

Customized Popup

Name: \%s
Time: \%s", - data$Name, data$time) +data$popup <- sprintf( + "

Customized Popup

Name: \%s
Time: \%s", + data$Name, data$time +) data <- split(data, f = data$Name) leaflet() \%>\% addTiles() \%>\% - addPlayback(data = data, - popup = ~popup, - label = ~label, - popupOptions = popupOptions(offset=c(0,-35)), - labelOptions = labelOptions(noHide = TRUE), - options = playbackOptions(radius = 3, - tickLen = 1000000, - speed = 5000, - maxInterpolationTime = 10000, - transitionpopup = FALSE, - transitionlabel = FALSE, - playCommand = "Let's go", - stopCommand = "Stop it!", - color = c("red","green","blue", - "orange","yellow")), - pathOpts = pathOptions(weight = 5)) + addPlayback( + data = data, + popup = ~popup, + label = ~label, + popupOptions = popupOptions(offset = c(0, -35)), + labelOptions = labelOptions(noHide = TRUE), + options = playbackOptions( + radius = 3, + tickLen = 1000000, + speed = 5000, + maxInterpolationTime = 10000, + transitionpopup = FALSE, + transitionlabel = FALSE, + playCommand = "Let's go", + stopCommand = "Stop it!", + color = c( + "red", "green", "blue", + "orange", "yellow" + ) + ), + pathOpts = pathOptions(weight = 5) + ) } \references{ \url{https://github.com/hallahan/LeafletPlayback} diff --git a/man/addReachability.Rd b/man/addReachability.Rd index 3c4bdda6..b4691613 100644 --- a/man/addReachability.Rd +++ b/man/addReachability.Rd @@ -37,7 +37,7 @@ When used in Shiny, 3 events update a certain shiny Input: library(leaflet) library(leaflet.extras2) -Sys.setenv("OPRS" = 'Your_API_Key') +Sys.setenv("OPRS" = "Your_API_Key") leaflet() \%>\% addTiles() \%>\% diff --git a/man/addSidebar.Rd b/man/addSidebar.Rd index 9f5043b1..b48a30ac 100644 --- a/man/addSidebar.Rd +++ b/man/addSidebar.Rd @@ -30,12 +30,16 @@ The sidebar HTML must be created with \code{\link{sidebar_tabs}} and library(shiny) # run example app showing a single sidebar -runApp(paste0(system.file("examples", package = "leaflet.extras2"), - "/sidebar_app.R")) +runApp(paste0( + system.file("examples", package = "leaflet.extras2"), + "/sidebar_app.R" +)) # run example app showing two sidebars -runApp(paste0(system.file("examples", package = "leaflet.extras2"), - "/multi_sidebar_app.R")) +runApp(paste0( + system.file("examples", package = "leaflet.extras2"), + "/multi_sidebar_app.R" +)) } } \references{ diff --git a/man/addSidebyside.Rd b/man/addSidebyside.Rd index 963db34e..94c910d0 100644 --- a/man/addSidebyside.Rd +++ b/man/addSidebyside.Rd @@ -44,19 +44,29 @@ library(leaflet.extras2) leaflet(quakes) \%>\% addMapPane("left", zIndex = 0) \%>\% addMapPane("right", zIndex = 0) \%>\% - addTiles(group = "base", layerId = "baseid", - options = pathOptions(pane = "right")) \%>\% - addProviderTiles(providers$CartoDB.DarkMatter, group="carto", layerId = "cartoid", - options = pathOptions(pane = "left")) \%>\% - addCircleMarkers(data = breweries91[1:15,], color = "blue", group = "blue", - options = pathOptions(pane = "left")) \%>\% - addCircleMarkers(data = breweries91[15:20,], color = "yellow", group = "yellow") \%>\% - addCircleMarkers(data = breweries91[15:30,], color = "red", group = "red", - options = pathOptions(pane = "right")) \%>\% - addLayersControl(overlayGroups = c("blue","red", "yellow")) \%>\% - addSidebyside(layerId = "sidecontrols", - rightId = "baseid", - leftId = "cartoid") + addTiles( + group = "base", layerId = "baseid", + options = pathOptions(pane = "right") + ) \%>\% + addProviderTiles(providers$CartoDB.DarkMatter, + group = "carto", layerId = "cartoid", + options = pathOptions(pane = "left") + ) \%>\% + addCircleMarkers( + data = breweries91[1:15, ], color = "blue", group = "blue", + options = pathOptions(pane = "left") + ) \%>\% + addCircleMarkers(data = breweries91[15:20, ], color = "yellow", group = "yellow") \%>\% + addCircleMarkers( + data = breweries91[15:30, ], color = "red", group = "red", + options = pathOptions(pane = "right") + ) \%>\% + addLayersControl(overlayGroups = c("blue", "red", "yellow")) \%>\% + addSidebyside( + layerId = "sidecontrols", + rightId = "baseid", + leftId = "cartoid" + ) } \references{ \url{https://github.com/digidem/leaflet-side-by-side} diff --git a/man/addSpinner.Rd b/man/addSpinner.Rd index 678748d1..261781bd 100644 --- a/man/addSpinner.Rd +++ b/man/addSpinner.Rd @@ -31,7 +31,7 @@ leaflet(data = quakes) \%>\% addTiles() \%>\% addSpinner() \%>\% startSpinner(options = list("lines" = 7, "length" = 20)) \%>\% - addMarkers(~long, ~lat, popup = ~as.character(mag), label = ~as.character(mag)) \%>\% + addMarkers(~long, ~lat, popup = ~ as.character(mag), label = ~ as.character(mag)) \%>\% stopSpinner() } \references{ diff --git a/man/addTangram.Rd b/man/addTangram.Rd index 082e9b77..345c874c 100644 --- a/man/addTangram.Rd +++ b/man/addTangram.Rd @@ -56,8 +56,10 @@ server <- function(input, output, session) { addTangram(scene = scene, group = "tangram") \%>\% addCircleMarkers(data = breweries91, group = "brews") \%>\% setView(11, 49.4, 14) \%>\% - addLayersControl(baseGroups = c("tangram", "base"), - overlayGroups = c("brews")) + addLayersControl( + baseGroups = c("tangram", "base"), + overlayGroups = c("brews") + ) }) } diff --git a/man/addTimeslider.Rd b/man/addTimeslider.Rd index 05d4497d..a19dab78 100644 --- a/man/addTimeslider.Rd +++ b/man/addTimeslider.Rd @@ -84,18 +84,22 @@ library(leaflet) library(leaflet.extras2) library(sf) -data <- sf::st_as_sf(leaflet::atlStorms2005[1,]) +data <- sf::st_as_sf(leaflet::atlStorms2005[1, ]) data <- st_cast(data, "POINT") -data$time = as.POSIXct( - seq.POSIXt(Sys.time() - 1000, Sys.time(), length.out = nrow(data))) +data$time <- as.POSIXct( + seq.POSIXt(Sys.time() - 1000, Sys.time(), length.out = nrow(data)) +) leaflet() \%>\% addTiles() \%>\% - addTimeslider(data = data, - options = timesliderOptions( - position = "topright", - timeAttribute = "time", - range = TRUE)) \%>\% + addTimeslider( + data = data, + options = timesliderOptions( + position = "topright", + timeAttribute = "time", + range = TRUE + ) + ) \%>\% setView(-72, 22, 4) } \references{ diff --git a/man/addVelocity.Rd b/man/addVelocity.Rd index 97e776b0..ddc3a62f 100644 --- a/man/addVelocity.Rd +++ b/man/addVelocity.Rd @@ -24,8 +24,8 @@ identifier-style names. Any number of layers and even different types of layers (e.g. markers and polygons) can share the same group name.} \item{content}{the path or URL to a JSON file representing the velocity data -or a data.frame which can be transformed to such a JSON file. Please see the -\href{https://github.com/onaci/leaflet-velocity/tree/master/demo}{demo +or a data.frame which can be transformed to such a JSON file. Please see +the \href{https://github.com/onaci/leaflet-velocity/tree/master/demo}{demo files} for some example data.} \item{options}{List of further options. See \code{\link{velocityOptions}}} diff --git a/man/addWMS.Rd b/man/addWMS.Rd index fc119873..feafadfe 100644 --- a/man/addWMS.Rd +++ b/man/addWMS.Rd @@ -55,7 +55,8 @@ A Leaflet plugin for working with Web Map services, providing: single-tile/untiled/nontiled layers, shared WMS sources, and \bold{GetFeatureInfo}-powered identify. -You can also use \bold{CQL-Filters} by appending a string to the \code{'baseUrl'}. +You can also use \bold{CQL-Filters} by appending a string +to the \code{'baseUrl'}. Something like \code{'http://server/wms?cql_filter=attribute=value'} } @@ -66,14 +67,17 @@ library(leaflet.extras2) leaflet() \%>\% addTiles(group = "base") \%>\% setView(9, 50, 5) \%>\% - addWMS(baseUrl = "https://maps.dwd.de/geoserver/dwd/wms", - layers = "dwd:BRD_1km_winddaten_10m", - popupOptions = popupOptions(maxWidth = 600), - checkempty = TRUE, - options = WMSTileOptions( - transparent = TRUE, - format = "image/png", - info_format = "text/html")) + addWMS( + baseUrl = "https://maps.dwd.de/geoserver/dwd/wms", + layers = "dwd:BRD_1km_winddaten_10m", + popupOptions = popupOptions(maxWidth = 600), + checkempty = TRUE, + options = WMSTileOptions( + transparent = TRUE, + format = "image/png", + info_format = "text/html" + ) + ) } \references{ \url{https://github.com/heigeo/leaflet.wms} diff --git a/man/easyprintMap.Rd b/man/easyprintMap.Rd index 9edd05b9..f0689ba5 100644 --- a/man/easyprintMap.Rd +++ b/man/easyprintMap.Rd @@ -26,33 +26,33 @@ Print or export a map programmatically (e.g. in a Shiny environment). \examples{ ## Only run examples in interactive R sessions if (interactive()) { -library(shiny) -library(leaflet) -library(leaflet.extras2) + library(shiny) + library(leaflet) + library(leaflet.extras2) -ui <- fluidPage( - leafletOutput("map"), - selectInput("scene", "Select Scene", choices = c("CurrentSize", "A4Landscape", "A4Portrait")), - actionButton("print", "Print Map") -) + ui <- fluidPage( + leafletOutput("map"), + selectInput("scene", "Select Scene", choices = c("CurrentSize", "A4Landscape", "A4Portrait")), + actionButton("print", "Print Map") + ) -server <- function(input, output, session) { - output$map <- renderLeaflet({ - input$print - leaflet() \%>\% - addTiles() \%>\% - setView(10, 50, 9) \%>\% - addEasyprint(options = easyprintOptions( - exportOnly = TRUE - )) -}) - observeEvent(input$print, { - leafletProxy("map") \%>\% - easyprintMap(sizeModes = input$scene) -}) -} + server <- function(input, output, session) { + output$map <- renderLeaflet({ + input$print + leaflet() \%>\% + addTiles() \%>\% + setView(10, 50, 9) \%>\% + addEasyprint(options = easyprintOptions( + exportOnly = TRUE + )) + }) + observeEvent(input$print, { + leafletProxy("map") \%>\% + easyprintMap(sizeModes = input$scene) + }) + } -shinyApp(ui, server) + shinyApp(ui, server) } } \seealso{ diff --git a/man/historyOptions.Rd b/man/historyOptions.Rd index 4f10f985..83afcc81 100644 --- a/man/historyOptions.Rd +++ b/man/historyOptions.Rd @@ -63,14 +63,15 @@ History Options } \examples{ library(leaflet) -leaflet() \%>\% +leaflet() \%>\% addTiles() \%>\% - addHistory(options = historyOptions(position = "bottomright", + addHistory(options = historyOptions( + position = "bottomright", maxMovesToSave = 20, - backText = "Go back", + backText = "Go back", forwardText = "Go forward", orientation = "vertical" - )) + )) } \references{ \url{https://github.com/cscott530/leaflet-history} diff --git a/man/makeMapkeyIcon.Rd b/man/makeMapkeyIcon.Rd index d91941b6..3703af33 100644 --- a/man/makeMapkeyIcon.Rd +++ b/man/makeMapkeyIcon.Rd @@ -50,11 +50,13 @@ A list of mapkey-icon data that can be passed to the argument \code{icon} Make Mapkey Icon } \examples{ -makeMapkeyIcon(icon = "traffic_signal", - color = "#0000ff", - iconSize = 12, - boxShadow = FALSE, - background="transparent") +makeMapkeyIcon( + icon = "traffic_signal", + color = "#0000ff", + iconSize = 12, + boxShadow = FALSE, + background = "transparent" +) } \references{ \url{https://github.com/mapshakers/leaflet-mapkey-icon} diff --git a/man/mapkeyIconList.Rd b/man/mapkeyIconList.Rd index 90e1ceee..6a1d1d99 100644 --- a/man/mapkeyIconList.Rd +++ b/man/mapkeyIconList.Rd @@ -16,7 +16,7 @@ A list of class \code{"leaflet_mapkey_icon_set"} Make Mapkey-icon set } \examples{ -iconSet = mapkeyIconList( +iconSet <- mapkeyIconList( red = makeMapkeyIcon(color = "#ff0000"), blue = makeMapkeyIcon(color = "#0000ff") ) diff --git a/man/mapkeyIcons.Rd b/man/mapkeyIcons.Rd index 9edcaacb..18036d25 100644 --- a/man/mapkeyIcons.Rd +++ b/man/mapkeyIcons.Rd @@ -55,12 +55,15 @@ these arguments will be ignored. \examples{ \dontrun{ library(leaflet) -leaflet() \%>\% - addMapkeyMarkers(data = breweries91, - icon = mapkeyIcons( - color = "red", - borderRadius = 0, - iconSize = 25)) +leaflet() \%>\% + addMapkeyMarkers( + data = breweries91, + icon = mapkeyIcons( + color = "red", + borderRadius = 0, + iconSize = 25 + ) + ) } } \references{ diff --git a/man/setBuildingStyle.Rd b/man/setBuildingStyle.Rd index 713c498f..4bb1f2b7 100644 --- a/man/setBuildingStyle.Rd +++ b/man/setBuildingStyle.Rd @@ -27,7 +27,7 @@ leaflet() \%>\% addTiles() \%>\% addBuildings() \%>\% setBuildingStyle(style) \%>\% - setView(13.40, 52.51836,15) + setView(13.40, 52.51836, 15) } \seealso{ Other OSM-Buildings Plugin: diff --git a/man/sidebar_tabs.Rd b/man/sidebar_tabs.Rd index c215f4cf..da386611 100644 --- a/man/sidebar_tabs.Rd +++ b/man/sidebar_tabs.Rd @@ -26,12 +26,16 @@ Create a Sidebar library(shiny) # run example app showing a single sidebar -runApp(paste0(system.file("examples", package = "leaflet.extras2"), - "/sidebar_app.R")) +runApp(paste0( + system.file("examples", package = "leaflet.extras2"), + "/sidebar_app.R" +)) # run example app showing two sidebars -runApp(paste0(system.file("examples", package = "leaflet.extras2"), - "/multi_sidebar_app.R")) +runApp(paste0( + system.file("examples", package = "leaflet.extras2"), + "/multi_sidebar_app.R" +)) } } \references{ diff --git a/man/updateBuildingTime.Rd b/man/updateBuildingTime.Rd index 7838c312..ec3ccb17 100644 --- a/man/updateBuildingTime.Rd +++ b/man/updateBuildingTime.Rd @@ -22,7 +22,7 @@ leaflet() \%>\% addTiles() \%>\% addBuildings() \%>\% updateBuildingTime(as.POSIXct("2024-09-01 19:00:00 CET")) \%>\% - setView(13.40, 52.51836,15) + setView(13.40, 52.51836, 15) } \seealso{ Other OSM-Buildings Plugin: diff --git a/man/velocityOptions.Rd b/man/velocityOptions.Rd index c6f94957..c03da992 100644 --- a/man/velocityOptions.Rd +++ b/man/velocityOptions.Rd @@ -26,7 +26,8 @@ per hour or 'kt' for knots} \item{colorScale}{A vector of hex colors or an RGB matrix} \item{...}{Further arguments passed to the Velocity layer and Windy.js. -For more information, please visit \href{https://github.com/onaci/leaflet-velocity}{leaflet-velocity plugin}} +For more information, please visit +\href{https://github.com/onaci/leaflet-velocity}{leaflet-velocity plugin}} } \value{ A list of further options for \code{addVelocity}