Title: | Extra Functionality for 'leaflet' Package |
---|---|
Description: | Several 'leaflet' plugins are integrated, which are available as extension to the 'leaflet' package. |
Authors: | Gatscha Sebastian [aut, cre], Ricardo Rodrigo Basa [ctb], Jeffrey O Hanson [ctb] |
Maintainer: | Gatscha Sebastian <[email protected]> |
License: | GPL-3 | file LICENSE |
Version: | 1.2.2.9000 |
Built: | 2024-10-31 04:50:51 UTC |
Source: | https://github.com/trafficonese/leaflet.extras2 |
leaflet_mapkey_icon_set
## S3 method for class 'leaflet_mapkey_icon_set' x[i]
## S3 method for class 'leaflet_mapkey_icon_set' x[i]
x |
icons |
i |
offset |
Other Mapkey Functions:
addMapkeyMarkers()
,
makeMapkeyIcon()
,
mapkeyIconList()
,
mapkeyIcons()
Can be used almost exactly like addPolylines
but instead of
pathOptions
you can use antpathOptions
to adapt the
Antpath behaviour. See
leaflet-ant-path
for further details.
addAntpath( map, lng = NULL, lat = NULL, layerId = NULL, group = NULL, stroke = TRUE, color = "#03F", weight = 5, opacity = 0.5, fill = FALSE, fillColor = color, fillOpacity = 0.2, dashArray = NULL, smoothFactor = 1, noClip = FALSE, popup = NULL, popupOptions = NULL, label = NULL, labelOptions = NULL, options = antpathOptions(), highlightOptions = NULL, data = getMapData(map) )
addAntpath( map, lng = NULL, lat = NULL, layerId = NULL, group = NULL, stroke = TRUE, color = "#03F", weight = 5, opacity = 0.5, fill = FALSE, fillColor = color, fillOpacity = 0.2, dashArray = NULL, smoothFactor = 1, noClip = FALSE, popup = NULL, popupOptions = NULL, label = NULL, labelOptions = NULL, options = antpathOptions(), highlightOptions = NULL, data = getMapData(map) )
map |
a map widget object created from |
lng |
a numeric vector of longitudes, or a one-sided formula of the form
|
lat |
a vector of latitudes or a formula (similar to the |
layerId |
the layer id |
group |
the name of the group the newly created layers should belong to
(for |
stroke |
whether to draw stroke along the path (e.g. the borders of polygons or circles) |
color |
stroke color |
weight |
stroke width in pixels |
opacity |
stroke opacity (or layer opacity for tile layers) |
fill |
whether to fill the path with color (e.g. filling on polygons or circles) |
fillColor |
fill color |
fillOpacity |
fill opacity |
dashArray |
a string that defines the stroke dash pattern |
smoothFactor |
how much to simplify the polyline on each zoom level (more means better performance and less accurate representation) |
noClip |
whether to disable polyline clipping |
popup |
a character vector of the HTML content for the popups (you are
recommended to escape the text using |
popupOptions |
A Vector of |
label |
a character vector of the HTML content for the labels |
labelOptions |
A Vector of |
options |
A named list of options. See |
highlightOptions |
Options for highlighting the shape on mouse over. |
data |
the data object from which the argument values are derived; by
default, it is the |
A modified leaflet map, with an 'ant-path' animated polyline
https://github.com/rubenspgcavalcante/leaflet-ant-path
Other Antpath Functions:
antpathOptions()
,
clearAntpath()
,
removeAntpath()
library(leaflet) leaflet() %>% addAntpath(data = atlStorms2005)
library(leaflet) leaflet() %>% addAntpath(data = atlStorms2005)
Can be used almost exactly like addPolylines
but instead of
pathOptions
you can use arrowheadOptions
. See
leaflet-arrowheads
for further details.
addArrowhead( map, lng = NULL, lat = NULL, layerId = NULL, group = NULL, stroke = TRUE, color = "#03F", weight = 5, opacity = 0.5, fill = FALSE, fillColor = color, fillOpacity = 0.2, dashArray = NULL, smoothFactor = 1, noClip = FALSE, popup = NULL, popupOptions = NULL, label = NULL, labelOptions = NULL, options = arrowheadOptions(), highlightOptions = NULL, data = getMapData(map) )
addArrowhead( map, lng = NULL, lat = NULL, layerId = NULL, group = NULL, stroke = TRUE, color = "#03F", weight = 5, opacity = 0.5, fill = FALSE, fillColor = color, fillOpacity = 0.2, dashArray = NULL, smoothFactor = 1, noClip = FALSE, popup = NULL, popupOptions = NULL, label = NULL, labelOptions = NULL, options = arrowheadOptions(), highlightOptions = NULL, data = getMapData(map) )
map |
a map widget object created from |
lng |
a numeric vector of longitudes, or a one-sided formula of the form
|
lat |
a vector of latitudes or a formula (similar to the |
layerId |
the layer id |
group |
the name of the group the newly created layers should belong to
(for |
stroke |
whether to draw stroke along the path (e.g. the borders of polygons or circles) |
color |
stroke color |
weight |
stroke width in pixels |
opacity |
stroke opacity (or layer opacity for tile layers) |
fill |
whether to fill the path with color (e.g. filling on polygons or circles) |
fillColor |
fill color |
fillOpacity |
fill opacity |
dashArray |
a string that defines the stroke dash pattern |
smoothFactor |
how much to simplify the polyline on each zoom level (more means better performance and less accurate representation) |
noClip |
whether to disable polyline clipping |
popup |
a character vector of the HTML content for the popups (you are
recommended to escape the text using |
popupOptions |
A Vector of |
label |
a character vector of the HTML content for the labels |
labelOptions |
A Vector of |
options |
A named list of options. See |
highlightOptions |
Options for highlighting the shape on mouse over. |
data |
the data object from which the argument values are derived; by
default, it is the |
A modified leaflet map with a polyline with arrowheads
https://github.com/slutske22/leaflet-arrowheads
Other Arrowhead Functions:
arrowheadOptions()
,
clearArrowhead()
,
removeArrowhead()
library(leaflet) leaflet() %>% addArrowhead(data = atlStorms2005)
library(leaflet) leaflet() %>% addArrowhead(data = atlStorms2005)
This function adds 2.5D buildings to a Leaflet map using the OSM Buildings plugin.
addBuildings( map, buildingURL = "https://{s}.data.osmbuildings.org/0.2/59fcc2e8/tile/{z}/{x}/{y}.json", group = NULL, eachFn = NULL, clickFn = NULL, data = NULL )
addBuildings( map, buildingURL = "https://{s}.data.osmbuildings.org/0.2/59fcc2e8/tile/{z}/{x}/{y}.json", group = NULL, eachFn = NULL, clickFn = NULL, data = NULL )
map |
A map widget object created from |
buildingURL |
The URL template for the building data. Default is the OSM Buildings tile server: |
group |
The name of the group the buildings will be added to. |
eachFn |
A JavaScript function (using |
clickFn |
A JavaScript function (using |
data |
A GeoJSON object containing Polygon features representing the buildings. The properties of these polygons can include attributes like |
The 'data' parameter allows you to provide custom building data as a GeoJSON object. The following properties can be used within the GeoJSON:
height
minHeight
color/wallColor
material
roofColor
roofMaterial
shape
roofShape
roofHeight
See the OSM Wiki: Simple_3D_Buildings
https://github.com/kekscom/osmbuildings/ for more details on the OSM Buildings plugin and available properties.
Other OSM-Buildings Plugin:
setBuildingData()
,
setBuildingStyle()
,
updateBuildingTime()
library(leaflet) library(leaflet.extras2) leaflet() %>% addProviderTiles("CartoDB") %>% addBuildings(group = "Buildings") %>% addLayersControl(overlayGroups = "Buildings") %>% setView(lng = 13.4, lat = 52.51, zoom = 15)
library(leaflet) library(leaflet.extras2) leaflet() %>% addProviderTiles("CartoDB") %>% addBuildings(group = "Buildings") %>% addLayersControl(overlayGroups = "Buildings") %>% setView(lng = 13.4, lat = 52.51, zoom = 15)
Clusters markers on a Leaflet map and visualizes them using
customizable charts, such as pie or bar charts, showing counts by category.
When using the "custom"
type, a pie chart is rendered with aggregated data,
employing methods like sum, min, max, mean, or median.
addClusterCharts( map, layerId = NULL, group = NULL, type = c("pie", "bar", "horizontal", "custom"), aggregation = c("sum", "min", "max", "mean", "median"), valueField = NULL, options = clusterchartOptions(), icon = NULL, html = NULL, popup = NULL, popupOptions = NULL, label = NULL, labelOptions = NULL, clusterOptions = NULL, clusterId = NULL, categoryField, categoryMap, popupFields = NULL, popupLabels = NULL, markerOptions = NULL, legendOptions = list(title = "", position = "topright"), data = getMapData(map) )
addClusterCharts( map, layerId = NULL, group = NULL, type = c("pie", "bar", "horizontal", "custom"), aggregation = c("sum", "min", "max", "mean", "median"), valueField = NULL, options = clusterchartOptions(), icon = NULL, html = NULL, popup = NULL, popupOptions = NULL, label = NULL, labelOptions = NULL, clusterOptions = NULL, clusterId = NULL, categoryField, categoryMap, popupFields = NULL, popupLabels = NULL, markerOptions = NULL, legendOptions = list(title = "", position = "topright"), data = getMapData(map) )
map |
a map widget object created from |
layerId |
the layer id |
group |
the name of the group the newly created layers should belong to
(for |
type |
The type of chart to use for clusters: |
aggregation |
Aggregation method for |
valueField |
Column name with values to aggregate for |
options |
Additional options for cluster charts (see |
icon |
An icon or set of icons to include, created with |
html |
The column name containing the HTML content to include in the markers. |
popup |
The column name used to retrieve feature properties for the popup. |
popupOptions |
A Vector of |
label |
a character vector of the HTML content for the labels |
labelOptions |
A Vector of |
clusterOptions |
if not |
clusterId |
the id for the marker cluster layer |
categoryField |
Column name for categorizing charts. |
categoryMap |
A data.frame mapping categories to chart properties (e.g., label, color, icons, stroke). |
popupFields |
A string or vector of strings indicating the column names to include in popups. |
popupLabels |
A string or vector of strings indicating the labels for the popup fields. |
markerOptions |
Additional options for markers (see |
legendOptions |
A list of options for the legend, including the title and position. |
data |
the data object from which the argument values are derived; by
default, it is the |
The ‘clusterCharts' use Leaflet’s 'L.DivIcon', allowing you to fully customize the styling of individual markers and clusters using CSS. Each individual marker within a cluster is assigned the CSS class 'clustermarker', while the entire cluster is assigned the class 'clustermarker-cluster'. You can modify the appearance of these elements by targeting these classes in your custom CSS.
Other clusterCharts:
clusterchartOptions()
# Example usage: library(sf) library(leaflet) library(leaflet.extras2) data <- sf::st_as_sf(breweries91) categories <- c("Schwer", "Mäßig", "Leicht", "kein Schaden") data$category <- sample(categories, size = nrow(data), replace = TRUE) ## Pie Chart 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" ) ## 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" ) ## Custom Pie Chart with "mean" aggregation on column "value" data <- sf::st_as_sf(breweries91) categories <- c("Schwer", "Mäßig", "Leicht", "kein Schaden") data$category <- sample(categories, size = nrow(data), replace = TRUE) 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" ) ## For Shiny examples, please run: # runApp(system.file("examples/clusterCharts_app.R", package = "leaflet.extras2")) # runApp(system.file("examples/clustercharts_sum.R", package = "leaflet.extras2"))
# Example usage: library(sf) library(leaflet) library(leaflet.extras2) data <- sf::st_as_sf(breweries91) categories <- c("Schwer", "Mäßig", "Leicht", "kein Schaden") data$category <- sample(categories, size = nrow(data), replace = TRUE) ## Pie Chart 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" ) ## 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" ) ## Custom Pie Chart with "mean" aggregation on column "value" data <- sf::st_as_sf(breweries91) categories <- c("Schwer", "Mäßig", "Leicht", "kein Schaden") data$category <- sample(categories, size = nrow(data), replace = TRUE) 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" ) ## For Shiny examples, please run: # runApp(system.file("examples/clusterCharts_app.R", package = "leaflet.extras2")) # runApp(system.file("examples/clustercharts_sum.R", package = "leaflet.extras2"))
Adds customizable DivIcon markers to a Leaflet map. The function can accept either spatial data (lines or points) in the form of a Simple Feature (sf) object or numeric vectors for latitude and longitude coordinates. It allows for the application of custom HTML content and CSS classes to each marker, providing high flexibility in marker design.
addDivicon( map, lng = NULL, lat = NULL, layerId = NULL, group = NULL, popup = NULL, popupOptions = NULL, label = NULL, labelOptions = NULL, className = NULL, html = NULL, options = markerOptions(), clusterOptions = NULL, clusterId = NULL, divOptions = list(), data = getMapData(map) )
addDivicon( map, lng = NULL, lat = NULL, layerId = NULL, group = NULL, popup = NULL, popupOptions = NULL, label = NULL, labelOptions = NULL, className = NULL, html = NULL, options = markerOptions(), clusterOptions = NULL, clusterId = NULL, divOptions = list(), data = getMapData(map) )
map |
The Leaflet map object to which the DivIcon markers will be added. |
lng |
a numeric vector of longitudes, or a one-sided formula of the form
|
lat |
a vector of latitudes or a formula (similar to the |
layerId |
the layer id |
group |
the name of the group the newly created layers should belong to
(for |
popup |
a character vector of the HTML content for the popups (you are
recommended to escape the text using |
popupOptions |
A Vector of |
label |
a character vector of the HTML content for the labels |
labelOptions |
A Vector of |
className |
A single CSS class or a vector of CSS classes to apply to the DivIcon markers. |
html |
A single HTML string or a vector of HTML strings to display within the DivIcon markers. |
options |
A list of extra options for the markers.
See |
clusterOptions |
if not |
clusterId |
the id for the marker cluster layer |
divOptions |
A list of extra options for Leaflet DivIcon. |
data |
the data object from which the argument values are derived; by
default, it is the |
The modified Leaflet map object.
library(sf) library(leaflet) 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$ID <- paste0("ID_", 1:nrow(df)) leaflet() %>% addTiles() %>% addDivicon( data = df, html = ~ paste0( '<div class="custom-html">', '<div class="title">', Name, "</div>", '<div class="subtitle">MaxWind: ', MaxWind, "</div>", "</div>" ), label = ~Name, layerId = ~ID, group = "Divicons", popup = ~ paste( "ID: ", ID, "<br>", "Name: ", Name, "<br>", "MaxWind:", MaxWind, "<br>", "MinPress:", MinPress ), options = markerOptions(draggable = TRUE) )
library(sf) library(leaflet) 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$ID <- paste0("ID_", 1:nrow(df)) leaflet() %>% addTiles() %>% addDivicon( data = df, html = ~ paste0( '<div class="custom-html">', '<div class="title">', Name, "</div>", '<div class="subtitle">MaxWind: ', MaxWind, "</div>", "</div>" ), label = ~Name, layerId = ~ID, group = "Divicons", popup = ~ paste( "ID: ", ID, "<br>", "Name: ", Name, "<br>", "MaxWind:", MaxWind, "<br>", "MinPress:", MinPress ), options = markerOptions(draggable = TRUE) )
Add a control, which allows to print or export a map as .PNG.
addEasyprint(map, options = easyprintOptions())
addEasyprint(map, options = easyprintOptions())
map |
a map widget object created from |
options |
A named list of options. See |
A leaflet map object
https://github.com/rowanwins/leaflet-easyPrint
Other EasyPrint Functions:
easyprintMap()
,
easyprintOptions()
,
removeEasyprint()
library(leaflet) leaflet() %>% addTiles() %>% addEasyprint(options = easyprintOptions( title = "Print map", position = "bottomleft", exportOnly = TRUE ))
library(leaflet) leaflet() %>% addTiles() %>% addEasyprint(options = easyprintOptions( title = "Print map", position = "bottomleft", exportOnly = TRUE ))
A leaflet plugin for NASA EOSDIS GIBS imagery integration. 154 products are available. The date can be set dynamically for multi-temporal products. No-data pixels of MODIS Multiband Imagery can be made transparent.
addGIBS( map, layers = NULL, group = NULL, dates = NULL, opacity = 0.5, transparent = TRUE )
addGIBS( map, layers = NULL, group = NULL, dates = NULL, opacity = 0.5, transparent = TRUE )
map |
a map widget object created from |
layers |
A character vector of GIBS-layers. See |
group |
the name of the group the newly created layers should belong to
(for |
dates |
Date object. If multiple |
opacity |
Numeric value determining the opacity. If multiple
|
transparent |
Should the layer be transparent. If multiple |
the new map
object
https://github.com/aparshin/leaflet-GIBS
Other GIBS Functions:
setDate()
,
setTransparent()
library(leaflet) library(leaflet.extras2) layers <- gibs_layers$title[c(35, 128, 185)] leaflet() %>% addTiles() %>% setView(9, 50, 4) %>% addGIBS( layers = layers, dates = Sys.Date() - 1, group = layers ) %>% addLayersControl(overlayGroups = layers)
library(leaflet) library(leaflet.extras2) layers <- gibs_layers$title[c(35, 128, 185)] leaflet() %>% addTiles() %>% setView(9, 50, 4) %>% addGIBS( layers = layers, dates = Sys.Date() - 1, group = layers ) %>% addLayersControl(overlayGroups = layers)
Visualize height information and road attributes of linestring segments.
The linestrings must be a Simple Feature LINESTRING Z and are transformed to
GeoJSON. The function therefore inherits arguments from
addGeoJSON
.
addHeightgraph( map, data = NULL, columns = NULL, layerId = NULL, group = NULL, color = "#03F", weight = 5, opacity = 0.5, dashArray = NULL, smoothFactor = 1, noClip = FALSE, pathOpts = leaflet::pathOptions(), options = heightgraphOptions() )
addHeightgraph( map, data = NULL, columns = NULL, layerId = NULL, group = NULL, color = "#03F", weight = 5, opacity = 0.5, dashArray = NULL, smoothFactor = 1, noClip = FALSE, pathOpts = leaflet::pathOptions(), options = heightgraphOptions() )
map |
a map widget object created from |
data |
A Simple Feature LINESTRING with Z dimension. |
columns |
A character vector of the columns you want to include in the heightgraph control |
layerId |
the layer id |
group |
the name of the group the newly created layers should belong to
(for |
color |
stroke color |
weight |
stroke width in pixels |
opacity |
stroke opacity (or layer opacity for tile layers) |
dashArray |
a string that defines the stroke dash pattern |
smoothFactor |
how much to simplify the polyline on each zoom level (more means better performance and less accurate representation) |
noClip |
whether to disable polyline clipping |
pathOpts |
List of further options for the path. See
|
options |
List of further plugin options. See
|
the new map
object
When used in Shiny, 3 events update a certain Shiny Input:
A click updates input$MAPID_heightgraph_click
A mouseover updates input$MAPID_heightgraph_mouseover
A mouseout updates input$MAPID_heightgraph_mouseout
If you want to explicitly remove the Heightgraph control, please use
removeControl
with the layerId = "hg_control"
.
https://github.com/GIScience/Leaflet.Heightgraph
Other Heightgraph Functions:
heightgraphOptions()
library(leaflet) library(leaflet.extras2) library(sf) 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) data$L1 <- NULL L1 <- round(seq.int(1, 4, length.out = nrow(data))) data <- st_as_sf(st_sfc(lapply(split(data, L1), function(x) { st_linestring(as.matrix(x)) }))) data$steepness <- 1:nrow(data) data$suitability <- nrow(data):1 data$popup <- apply(data, 1, function(x) { sprintf("Steepness: %s<br>Suitability: %s", x$steepness, x$suitability) }) leaflet() %>% addTiles(group = "base") %>% addHeightgraph( color = "red", columns = c("steepness", "suitability"), opacity = 1, data = data, group = "heightgraph", options = heightgraphOptions(width = 400) )
library(leaflet) library(leaflet.extras2) library(sf) 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) data$L1 <- NULL L1 <- round(seq.int(1, 4, length.out = nrow(data))) data <- st_as_sf(st_sfc(lapply(split(data, L1), function(x) { st_linestring(as.matrix(x)) }))) data$steepness <- 1:nrow(data) data$suitability <- nrow(data):1 data$popup <- apply(data, 1, function(x) { sprintf("Steepness: %s<br>Suitability: %s", x$steepness, x$suitability) }) leaflet() %>% addTiles(group = "base") %>% addHeightgraph( color = "red", columns = c("steepness", "suitability"), opacity = 1, data = data, group = "heightgraph", options = heightgraphOptions(width = 400) )
Create dynamic hexbin-based heatmaps on Leaflet maps. This plugin leverages the data-binding power of d3 to allow you to dynamically update the data and visualize the transitions.
addHexbin( map, lng = NULL, lat = NULL, radius = 20, layerId = NULL, group = NULL, opacity = 0.5, options = hexbinOptions(), data = getMapData(map) )
addHexbin( map, lng = NULL, lat = NULL, radius = 20, layerId = NULL, group = NULL, opacity = 0.5, options = hexbinOptions(), data = getMapData(map) )
map |
a map widget object created from |
lng |
a numeric vector of longitudes, or a one-sided formula of the form
|
lat |
a vector of latitudes or a formula (similar to the |
radius |
Radius of the hexbin layer |
layerId |
the layer id |
group |
the name of the group the newly created layers should belong to
(for |
opacity |
Opacity of the hexbin layer |
options |
List of further options. See |
data |
the data object from which the argument values are derived; by
default, it is the |
the new map
object
Currently doesn't respect layerId
nor group
.
https://github.com/bluehalo/leaflet-d3#hexbins-api
Other Hexbin-D3 Functions:
clearHexbin()
,
hexbinOptions()
,
hideHexbin()
,
showHexbin()
,
updateHexbin()
library(leaflet) library(leaflet.extras2) n <- 1000 df <- data.frame( lat = rnorm(n, 42.0285, .01), lng = rnorm(n, -93.65, .01) ) leaflet() %>% addTiles() %>% addHexbin( lng = df$lng, lat = df$lat, options = hexbinOptions( colorRange = c("red", "yellow", "blue"), radiusRange = c(10, 20) ) )
library(leaflet) library(leaflet.extras2) n <- 1000 df <- data.frame( lat = rnorm(n, 42.0285, .01), lng = rnorm(n, -93.65, .01) ) leaflet() %>% addTiles() %>% addHexbin( lng = df$lng, lat = df$lat, options = hexbinOptions( colorRange = c("red", "yellow", "blue"), radiusRange = c(10, 20) ) )
The plugin enables tracking of map movements in a history similar to a web browser. By default, it is a simple pair of buttons – back and forward.
addHistory(map, layerId = NULL, options = historyOptions())
addHistory(map, layerId = NULL, options = historyOptions())
map |
a map widget object created from |
layerId |
the control id |
options |
A named list of options. See |
the new map
object
https://github.com/cscott530/leaflet-history
Other History Functions:
clearFuture()
,
clearHistory()
,
goBackHistory()
,
goForwardHistory()
,
historyOptions()
library(leaflet) leaflet() %>% addTiles() %>% addHistory()
library(leaflet) leaflet() %>% addTiles() %>% addHistory()
The plugin allows to avoid cluttering in marker labels and gives priority to labels of your choice (with higher weight).
addLabelgun(map, group = NULL, weight = NULL, entries = NULL)
addLabelgun(map, group = NULL, weight = NULL, entries = NULL)
map |
A map widget object created from |
group |
The group name of the layer/s for which label collisions are
to be avoided.
To see the effects of this plugin the |
weight |
An optional weight for markers. If a vector is given, the length should match the number of all markers in the corresponding groups. If a numeric value is specified, it is used for each marker and thus no prioritization of the labels takes place. In all other cases a random integer is calculated. |
entries |
A numeric value, a higher value relates to faster insertion and slower search, and vice versa. The default is 10 |
A leaflet map object
It is important to invoke the function after the markers have been added to the map. Otherwise nothing will happen.
https://github.com/Geovation/labelgun
library(leaflet) library(leaflet.extras2) leaflet() %>% addTiles() %>% addMarkers( data = breweries91, label = ~brewery, group = "markers", labelOptions = labelOptions(permanent = TRUE) ) %>% addLabelgun("markers", 1)
library(leaflet) library(leaflet.extras2) leaflet() %>% addTiles() %>% addMarkers( data = breweries91, label = ~brewery, group = "markers", labelOptions = labelOptions(permanent = TRUE) ) %>% addLabelgun("markers", 1)
The plugin allows you to synchronize and unsynchronize multiple leaflet maps
in a Shiny application. You can pass additional options
to leafletsyncOptions
. For more information see
Leaflet.Sync
addLeafletsync( map, ids = NULL, synclist = "all", options = leafletsyncOptions() )
addLeafletsync( map, ids = NULL, synclist = "all", options = leafletsyncOptions() )
map |
the map |
ids |
the map ids to be synced. If you use a |
synclist |
The synchronization list. The default is |
options |
A named list of options. See |
A modified leaflet map
If you synchronize multiple maps, a map may not yet be
initialized and therefore cannot be used. Make sure to use
addLeafletsync
after all maps have been rendered.
https://github.com/jieter/Leaflet.Sync
Other leafletsync Functions:
addLeafletsyncDependency()
,
isSynced()
,
leafletsyncOptions()
,
unsync()
Sometimes it makes sense to include the Leaflet Sync dependencies already
before synchronizing maps. For example, if you want to use the
'L.Sync.offsetHelper'. See the example in
./inst/examples/offsetHelper.R
addLeafletsyncDependency(map)
addLeafletsyncDependency(map)
map |
the map |
A modified leaflet map
Other leafletsync Functions:
addLeafletsync()
,
isSynced()
,
leafletsyncOptions()
,
unsync()
Add Mapkey Markers
addMapkeyMarkers( map, lng = NULL, lat = NULL, layerId = NULL, group = NULL, icon = NULL, popup = NULL, popupOptions = NULL, label = NULL, labelOptions = NULL, options = leaflet::markerOptions(), clusterOptions = NULL, clusterId = NULL, data = leaflet::getMapData(map) )
addMapkeyMarkers( map, lng = NULL, lat = NULL, layerId = NULL, group = NULL, icon = NULL, popup = NULL, popupOptions = NULL, label = NULL, labelOptions = NULL, options = leaflet::markerOptions(), clusterOptions = NULL, clusterId = NULL, data = leaflet::getMapData(map) )
map |
the map to add mapkey Markers to. |
lng |
a numeric vector of longitudes, or a one-sided formula of the form
|
lat |
a vector of latitudes or a formula (similar to the |
layerId |
the layer id |
group |
the name of the group the newly created layers should belong to
(for |
icon |
the icon(s) for markers; |
popup |
a character vector of the HTML content for the popups (you are
recommended to escape the text using |
popupOptions |
A Vector of |
label |
a character vector of the HTML content for the labels |
labelOptions |
A Vector of |
options |
a list of extra options for markers. See
|
clusterOptions |
if not |
clusterId |
the id for the marker cluster layer |
data |
the data object from which the argument values are derived; by
default, it is the |
the new map
object
https://github.com/mapshakers/leaflet-mapkey-icon
Other Mapkey Functions:
[.leaflet_mapkey_icon_set()
,
makeMapkeyIcon()
,
mapkeyIconList()
,
mapkeyIcons()
library(leaflet) leaflet() %>% addTiles() %>% addMapkeyMarkers( data = breweries91, icon = makeMapkeyIcon( icon = "mapkey", iconSize = 30, boxShadow = FALSE, background = "transparent" ), group = "mapkey", label = ~state, popup = ~village )
library(leaflet) leaflet() %>% addTiles() %>% addMapkeyMarkers( data = breweries91, icon = makeMapkeyIcon( icon = "mapkey", iconSize = 30, boxShadow = FALSE, background = "transparent" ), group = "mapkey", label = ~state, popup = ~village )
The function expects either line or point data as spatial data or as Simple Feature. Alternatively, coordinates can also be passed as numeric vectors.
addMovingMarker( map, lng = NULL, lat = NULL, layerId = NULL, group = NULL, duration = 2000, icon = NULL, popup = NULL, popupOptions = NULL, label = NULL, labelOptions = NULL, movingOptions = movingMarkerOptions(), options = leaflet::markerOptions(), data = leaflet::getMapData(map) )
addMovingMarker( map, lng = NULL, lat = NULL, layerId = NULL, group = NULL, duration = 2000, icon = NULL, popup = NULL, popupOptions = NULL, label = NULL, labelOptions = NULL, movingOptions = movingMarkerOptions(), options = leaflet::markerOptions(), data = leaflet::getMapData(map) )
map |
the map to add moving markers |
lng |
a numeric vector of longitudes, or a one-sided formula of the form
|
lat |
a vector of latitudes or a formula (similar to the |
layerId |
In order to be able to address the moving markings individually, a layerId is required. If none is specified, one is created that is derived from the current timestamp. |
group |
the name of the group the newly created layers should belong to
(for |
duration |
Duration in milliseconds per line segment between 2 points.
Can be a vector or a single number. Default is |
icon |
the icon(s) for markers; |
popup |
a character vector of the HTML content for the popups (you are
recommended to escape the text using |
popupOptions |
A Vector of |
label |
a character vector of the HTML content for the labels |
labelOptions |
A Vector of |
movingOptions |
a list of extra options for moving markers.
See |
options |
a list of extra options for markers. See
|
data |
the data object from which the argument values are derived; by
default, it is the |
the new map
object
https://github.com/ewoken/Leaflet.MovingMarker
Other MovingMarker Functions:
movingMarkerOptions()
,
startMoving()
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) leaflet() %>% addTiles() %>% addPolylines(data = df) %>% addMovingMarker( data = df, movingOptions = movingMarkerOptions(autostart = TRUE, loop = TRUE), label = "I am a pirate!", popup = "Arrr" )
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) leaflet() %>% addTiles() %>% addPolylines(data = df) %>% addMovingMarker( data = df, movingOptions = movingMarkerOptions(autostart = TRUE, loop = TRUE), label = "I am a pirate!", popup = "Arrr" )
Add current OpenWeatherMap Marker
addOpenweatherCurrent( map, apikey = NULL, group = NULL, layerId = NULL, options = openweatherCurrentOptions() )
addOpenweatherCurrent( map, apikey = NULL, group = NULL, layerId = NULL, options = openweatherCurrentOptions() )
map |
a map widget object created from |
apikey |
a valid Openweathermap-API key. |
group |
the name of the group the newly created layers should belong to
(for |
layerId |
the layer id |
options |
List of further options. See
|
the new map
object
The current weather icons will appear beginning with zoom level 9
and if used in Shiny, a click on an icon will update a Shiny input at
input$MAPID_owm_click
.
https://github.com/trafficonese/leaflet-openweathermap
Other Openweathermap Functions:
addOpenweatherTiles()
,
openweatherCurrentOptions()
,
openweatherOptions()
## Not run: library(leaflet) library(leaflet.extras2) Sys.setenv("OPENWEATHERMAP" = "Your_API_Key") leaflet() %>% addTiles() %>% setView(9, 50, 9) %>% addOpenweatherCurrent(options = openweatherCurrentOptions( lang = "en", popup = TRUE )) ## End(Not run)
## Not run: library(leaflet) library(leaflet.extras2) Sys.setenv("OPENWEATHERMAP" = "Your_API_Key") leaflet() %>% addTiles() %>% setView(9, 50, 9) %>% addOpenweatherCurrent(options = openweatherCurrentOptions( lang = "en", popup = TRUE )) ## End(Not run)
Add OpenWeatherMap Tiles
addOpenweatherTiles( map, apikey = NULL, layers = NULL, group = NULL, layerId = NULL, opacity = 0.5, options = openweatherOptions() )
addOpenweatherTiles( map, apikey = NULL, layers = NULL, group = NULL, layerId = NULL, opacity = 0.5, options = openweatherOptions() )
map |
a map widget object created from |
apikey |
a valid OpenWeatherMap-API key. |
layers |
character vector of layers you wish to add to the map. The
following layers are currently possible |
group |
the name of the group the newly created layers should belong to
(for |
layerId |
the layer id |
opacity |
opacity of the layer |
options |
List of further options. See |
the new map
object
Out of the box a legend image is only available for Pressure, Precipitation Classic, Clouds Classic, Rain Classic, Snow, Temperature and Wind Speed. Please add your own images if you need some more.
https://github.com/trafficonese/leaflet-openweathermap
Other Openweathermap Functions:
addOpenweatherCurrent()
,
openweatherCurrentOptions()
,
openweatherOptions()
## Not run: library(leaflet) library(leaflet.extras2) Sys.setenv("OPENWEATHERMAP" = "Your_API_Key") leaflet() %>% addTiles() %>% setView(9, 50, 6) %>% addOpenweatherTiles(layers = "wind") ## End(Not run)
## Not run: library(leaflet) library(leaflet.extras2) Sys.setenv("OPENWEATHERMAP" = "Your_API_Key") leaflet() %>% addTiles() %>% setView(9, 50, 6) %>% addOpenweatherTiles(layers = "wind") ## End(Not run)
The LeafletPlayback plugin provides the ability to replay GPS Points in the form of POINT Simple Features. Rather than simply animating a marker along a polyline, the speed of the animation is synchronized to a clock. The playback functionality is similar to a video player; you can start and stop playback or change the playback speed.
addPlayback( map, data, time = "time", icon = NULL, pathOpts = pathOptions(), popup = NULL, label = NULL, popupOptions = NULL, labelOptions = NULL, options = playbackOptions(), name = NULL )
addPlayback( map, data, time = "time", icon = NULL, pathOpts = pathOptions(), popup = NULL, label = NULL, popupOptions = NULL, labelOptions = NULL, options = playbackOptions(), name = NULL )
map |
a map widget |
data |
data must be a POINT Simple Feature or a list of POINT Simple Feature's with a time column. |
time |
The column name of the time column. Default is |
icon |
an icon which can be created with |
pathOpts |
style the CircleMarkers with
|
popup |
A formula with the column names for the popup content |
label |
A formula with the column names for the label content |
popupOptions |
A Vector of |
labelOptions |
A Vector of |
options |
List of additional options. See |
name |
A formula with the column names for the feature name |
the new map
object
If used in Shiny, you can listen to 2 events
'map-ID'+"_pb_mouseover"
'map-ID'+"_pb_click"
https://github.com/hallahan/LeafletPlayback
Other Playback Functions:
playbackOptions()
,
removePlayback()
library(leaflet) library(leaflet.extras2) library(sf) ## Single Elements 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$label <- as.character(data$time) leaflet() %>% addTiles() %>% addPlayback( data = data, label = ~label, popup = ~ sprintf( "I am a popup for <b>%s</b> and <b>%s</b>", 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$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) })) data$time <- as.POSIXct(data$time, origin = "1970-01-01") data$label <- paste0("Time: ", data$time) data$popup <- sprintf( "<h3>Customized Popup</h3><b>Name</b>: %s<br><b>Time</b>: %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) )
library(leaflet) library(leaflet.extras2) library(sf) ## Single Elements 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$label <- as.character(data$time) leaflet() %>% addTiles() %>% addPlayback( data = data, label = ~label, popup = ~ sprintf( "I am a popup for <b>%s</b> and <b>%s</b>", 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$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) })) data$time <- as.POSIXct(data$time, origin = "1970-01-01") data$label <- paste0("Time: ", data$time) data$popup <- sprintf( "<h3>Customized Popup</h3><b>Name</b>: %s<br><b>Time</b>: %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) )
A leaflet plugin which shows areas of reachability based on time or distance for different modes of travel using the openrouteservice isochrones API. Based on the leaflet.reachability plugin
addReachability(map, apikey = NULL, options = reachabilityOptions())
addReachability(map, apikey = NULL, options = reachabilityOptions())
map |
a map widget |
apikey |
a valid Openrouteservice API-key. Can be obtained from Openrouteservice |
options |
A list of further options. See |
the new map
object
When used in Shiny, 3 events update a certain shiny Input:
reachability:displayed updates input$MAPID_reachability_displayed
reachability:delete updates input$MAPID_reachability_delete
reachability:error updates input$MAPID_reachability_error
https://github.com/traffordDataLab/leaflet.reachability
Other Reachability Functions:
reachabilityOptions()
,
removeReachability()
## Not run: library(leaflet) library(leaflet.extras2) Sys.setenv("OPRS" = "Your_API_Key") leaflet() %>% addTiles() %>% setView(8, 50, 10) %>% addReachability() ## End(Not run)
## Not run: library(leaflet) library(leaflet.extras2) Sys.setenv("OPRS" = "Your_API_Key") leaflet() %>% addTiles() %>% setView(8, 50, 10) %>% addReachability() ## End(Not run)
The sidebar HTML must be created with sidebar_tabs
and
sidebar_pane
before
leafletOutput
is called.
addSidebar(map, id = "sidebar", options = list(position = "left"), ns = NULL)
addSidebar(map, id = "sidebar", options = list(position = "left"), ns = NULL)
map |
A leaflet map widget |
id |
Id of the sidebar-div. Must match with the |
options |
A named list with the only option |
ns |
The namespace function, if used in Shiny modules. |
the new map
object
https://github.com/Turbo87/sidebar-v2
Other Sidebar Functions:
closeSidebar()
,
openSidebar()
,
removeSidebar()
,
sidebar_pane()
,
sidebar_tabs()
## Not run: library(shiny) # run example app showing a single sidebar 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" )) ## End(Not run)
## Not run: library(shiny) # run example app showing a single sidebar 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" )) ## End(Not run)
A Leaflet control to add a split screen to compare two map overlays. The plugin works with Panes, see the example.
addSidebyside( map, layerId = NULL, leftId = NULL, rightId = NULL, options = list(thumbSize = 42, padding = 0) )
addSidebyside( map, layerId = NULL, leftId = NULL, rightId = NULL, options = list(thumbSize = 42, padding = 0) )
map |
a map widget |
layerId |
the layer id, needed for |
leftId |
the |
rightId |
the |
options |
A list of options. Currently only |
the new map
object
It is currently not working correctly if the baseGroups
are
defined in addLayersControl
.
https://github.com/digidem/leaflet-side-by-side
Other Sidebyside Functions:
removeSidebyside()
library(leaflet) 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" )
library(leaflet) 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" )
Adds an animated loading spinning over the map.
addSpinner(map) startSpinner(map, options = NULL) stopSpinner(map)
addSpinner(map) startSpinner(map, options = NULL) stopSpinner(map)
map |
A map widget object created from |
options |
Spin.js options. Named list. See http://spin.js.org |
A leaflet map object
https://github.com/makinacorpus/Leaflet.Spin
https://github.com/fgnass/spin.js
library(leaflet) library(leaflet.extras2) leaflet(data = quakes) %>% addTiles() %>% addSpinner() %>% startSpinner(options = list("lines" = 7, "length" = 20)) %>% addMarkers(~long, ~lat, popup = ~ as.character(mag), label = ~ as.character(mag)) %>% stopSpinner()
library(leaflet) library(leaflet.extras2) leaflet(data = quakes) %>% addTiles() %>% addSpinner() %>% startSpinner(options = list("lines" = 7, "length" = 20)) %>% addMarkers(~long, ~lat, popup = ~ as.character(mag), label = ~ as.character(mag)) %>% stopSpinner()
Adds a Tangram layer to a Leaflet map in a Shiny App.
addTangram(map, scene = NULL, layerId = NULL, group = NULL, options = NULL)
addTangram(map, scene = NULL, layerId = NULL, group = NULL, options = NULL)
map |
a map widget object created from |
scene |
Path to a required .yaml or .zip file. If the file
is within the |
layerId |
the layer id |
group |
the name of the group the newly created layers should belong to
(for |
options |
A list of further options. See the app in the
|
the new map
object
Only works correctly in a Shiny-App environment.
https://github.com/tangrams/tangram
## Not run: library(shiny) library(leaflet) library(leaflet.extras2) ## In the /www folder of a ShinyApp. Must contain the Nextzen API-key scene <- "scene.yaml" ui <- fluidPage(leafletOutput("map")) server <- function(input, output, session) { output$map <- renderLeaflet({ leaflet() %>% addTiles(group = "base") %>% addTangram(scene = scene, group = "tangram") %>% addCircleMarkers(data = breweries91, group = "brews") %>% setView(11, 49.4, 14) %>% addLayersControl( baseGroups = c("tangram", "base"), overlayGroups = c("brews") ) }) } shinyApp(ui, server) ## End(Not run)
## Not run: library(shiny) library(leaflet) library(leaflet.extras2) ## In the /www folder of a ShinyApp. Must contain the Nextzen API-key scene <- "scene.yaml" ui <- fluidPage(leafletOutput("map")) server <- function(input, output, session) { output$map <- renderLeaflet({ leaflet() %>% addTiles(group = "base") %>% addTangram(scene = scene, group = "tangram") %>% addCircleMarkers(data = breweries91, group = "brews") %>% setView(11, 49.4, 14) %>% addLayersControl( baseGroups = c("tangram", "base"), overlayGroups = c("brews") ) }) } shinyApp(ui, server) ## End(Not run)
The LeafletSlider plugin enables you to dynamically add and remove Markers/Lines on a map by using a JQuery UI slider.
addTimeslider( map, data, radius = 10, stroke = TRUE, color = "#03F", weight = 5, opacity = 0.5, fill = TRUE, fillColor = color, fillOpacity = 0.2, dashArray = NULL, popup = NULL, popupOptions = NULL, label = NULL, labelOptions = NULL, ordertime = TRUE, options = timesliderOptions() )
addTimeslider( map, data, radius = 10, stroke = TRUE, color = "#03F", weight = 5, opacity = 0.5, fill = TRUE, fillColor = color, fillOpacity = 0.2, dashArray = NULL, popup = NULL, popupOptions = NULL, label = NULL, labelOptions = NULL, ordertime = TRUE, options = timesliderOptions() )
map |
a map widget |
data |
data must be a Simple Feature collection of type POINT or LINESTRING with a column of class Date or POSIXct. |
radius |
a numeric vector of radii for the circles; it can also be a
one-sided formula, in which case the radius values are derived from the
|
stroke |
whether to draw stroke along the path (e.g. the borders of polygons or circles) |
color |
stroke color |
weight |
stroke width in pixels |
opacity |
stroke opacity (or layer opacity for tile layers) |
fill |
whether to fill the path with color (e.g. filling on polygons or circles) |
fillColor |
fill color |
fillOpacity |
fill opacity |
dashArray |
a string that defines the stroke dash pattern |
popup |
a character vector of the HTML content for the popups (you are
recommended to escape the text using |
popupOptions |
A Vector of |
label |
a character vector of the HTML content for the labels |
labelOptions |
A Vector of |
ordertime |
boolean value indicating whether to order the data by the
time column. The slider will adopt the order of the timestamps.
The default is |
options |
List of additional options. See |
the new map
object
https://github.com/dwilhelm89/LeafletSlider
Other Timeslider Functions:
removeTimeslider()
,
timesliderOptions()
library(leaflet) library(leaflet.extras2) library(sf) 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)) ) leaflet() %>% addTiles() %>% addTimeslider( data = data, options = timesliderOptions( position = "topright", timeAttribute = "time", range = TRUE ) ) %>% setView(-72, 22, 4)
library(leaflet) library(leaflet.extras2) library(sf) 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)) ) leaflet() %>% addTiles() %>% addTimeslider( data = data, options = timesliderOptions( position = "topright", timeAttribute = "time", range = TRUE ) ) %>% setView(-72, 22, 4)
Add velocity animated data to leaflet. Based on the leaflet-velocity plugin
addVelocity( map, layerId = NULL, group = NULL, content = NULL, options = velocityOptions() )
addVelocity( map, layerId = NULL, group = NULL, content = NULL, options = velocityOptions() )
map |
a map widget object created from |
layerId |
the layer id |
group |
the name of the group the newly created layers should belong to
(for |
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 demo files for some example data. |
options |
List of further options. See |
the new map
object
https://github.com/onaci/leaflet-velocity
Other Velocity Functions:
removeVelocity()
,
setOptionsVelocity()
,
velocityOptions()
## Not run: library(leaflet) library(leaflet.extras2) content <- "https://raw.githubusercontent.com/onaci/leaflet-velocity/master/demo/water-gbr.json" leaflet() %>% addTiles(group = "base") %>% setView(145, -20, 4) %>% addVelocity(content = content, group = "velo", layerId = "veloid") %>% addLayersControl(baseGroups = "base", overlayGroups = "velo") ## End(Not run)
## Not run: library(leaflet) library(leaflet.extras2) content <- "https://raw.githubusercontent.com/onaci/leaflet-velocity/master/demo/water-gbr.json" leaflet() %>% addTiles(group = "base") %>% setView(145, -20, 4) %>% addVelocity(content = content, group = "velo", layerId = "veloid") %>% addLayersControl(baseGroups = "base", overlayGroups = "velo") ## End(Not run)
A Leaflet plugin for working with Web Map services, providing: single-tile/untiled/nontiled layers, shared WMS sources, and GetFeatureInfo-powered identify.
You can also use CQL-Filters by appending a string
to the 'baseUrl'
.
Something like 'http://server/wms?cql_filter=attribute=value'
addWMS( map, baseUrl, layerId = NULL, group = NULL, options = WMSTileOptions(), attribution = NULL, layers = NULL, popupOptions = NULL, checkempty = FALSE, data = getMapData(map) )
addWMS( map, baseUrl, layerId = NULL, group = NULL, options = WMSTileOptions(), attribution = NULL, layers = NULL, popupOptions = NULL, checkempty = FALSE, data = getMapData(map) )
map |
a map widget object created from |
baseUrl |
a base URL of the WMS service |
layerId |
the layer id |
group |
the name of the group the newly created layers should belong to
(for |
options |
a list of extra options for tile layers, popups, paths (circles, rectangles, polygons, ...), or other map elements |
attribution |
the attribution text of the tile layer (HTML) |
layers |
comma-separated list of WMS layers to show |
popupOptions |
List of popup options. See
|
checkempty |
Should the returned HTML-content be checked for emptiness?
If the HTML-body is empty no popup is opened. Default is |
data |
the data object from which the argument values are derived; by
default, it is the |
the new map
object
https://github.com/heigeo/leaflet.wms
library(leaflet) 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" ) )
library(leaflet) 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" ) )
Additional list of options for 'ant-path' animated polylines.
antpathOptions( delay = 400, paused = FALSE, reverse = FALSE, hardwareAccelerated = FALSE, dashArray = c(10, 20), pulseColor = "#ffffff", lineCap = NULL, lineJoin = NULL, interactive = TRUE, pointerEvents = NULL, className = "", ... )
antpathOptions( delay = 400, paused = FALSE, reverse = FALSE, hardwareAccelerated = FALSE, dashArray = c(10, 20), pulseColor = "#ffffff", lineCap = NULL, lineJoin = NULL, interactive = TRUE, pointerEvents = NULL, className = "", ... )
delay |
Add a delay to the animation flux. Default is |
paused |
Should the animation be paused. Default is |
reverse |
Defines if the flow follows the path order or not. Default is
|
hardwareAccelerated |
Makes the animation run with hardware
acceleration. Default is |
dashArray |
The size of the animated dashes. Default is |
pulseColor |
Adds a color to the dashed flux. Default is |
lineCap |
a string that defines shape to be used at the end of the stroke |
lineJoin |
a string that defines shape to be used at the corners of the stroke |
interactive |
whether the element emits mouse events |
pointerEvents |
sets the |
className |
a CSS class name set on an element |
... |
extra options passed to underlying Javascript object constructor. |
A list of options for addAntpath
animated polylines
Other Antpath Functions:
addAntpath()
,
clearAntpath()
,
removeAntpath()
Additional list of options for polylines with arrowheads. You can also pass options inherited from L.Path
arrowheadOptions( yawn = 60, size = "15%", frequency = "allvertices", proportionalToTotal = FALSE, offsets = NULL, perArrowheadOptions = NULL, ... )
arrowheadOptions( yawn = 60, size = "15%", frequency = "allvertices", proportionalToTotal = FALSE, offsets = NULL, perArrowheadOptions = NULL, ... )
yawn |
Defines the width of the opening of the arrowhead, given in degrees. The larger the angle, the wider the arrowhead. |
size |
Determines the size of the arrowhead. Accepts three types of values:
|
frequency |
How many arrowheads are rendered on a polyline.
|
proportionalToTotal |
Only relevant when size is given as a percent.
Useful when frequency is set to |
offsets |
Enables the developer to have the arrowheads start or end at
some offset from the start and/or end of the polyline. This option can be a list
with 'start' and 'end' names. The values must be strings
defining the size of the offset in either meters or pixels, i.e.
|
perArrowheadOptions |
Enables the developer to customize arrowheads on a
one-by-one basis. Must be in the form of a function of i, which is the
index of the arrowhead as it is rendered in the loop through all
arrowheads. Must return an options object. Cannnot
account for |
... |
Additional options for arrowheads, inherited from L.Path |
A list of options for addArrowhead
polylines
https://github.com/slutske22/leaflet-arrowheads#options
Other Arrowhead Functions:
addArrowhead()
,
clearArrowhead()
,
removeArrowhead()
Clear all Antpaths
clearAntpath(map)
clearAntpath(map)
map |
a map widget object, possibly created from |
the new map
object
Other Antpath Functions:
addAntpath()
,
antpathOptions()
,
removeAntpath()
Remove arrowheads from Lines by group
clearArrowhead(map, group)
clearArrowhead(map, group)
map |
the map |
group |
A group name |
A modified leaflet map
Other Arrowhead Functions:
addArrowhead()
,
arrowheadOptions()
,
removeArrowhead()
Resets the stack of future items.
clearFuture(map)
clearFuture(map)
map |
a map widget object created from
|
the new map
object
https://github.com/cscott530/leaflet-history
Other History Functions:
addHistory()
,
clearHistory()
,
goBackHistory()
,
goForwardHistory()
,
historyOptions()
Clears the data of the hexbinLayer.
clearHexbin(map)
clearHexbin(map)
map |
The map widget |
the new map
object
Other Hexbin-D3 Functions:
addHexbin()
,
hexbinOptions()
,
hideHexbin()
,
showHexbin()
,
updateHexbin()
Resets the stack of history items.
clearHistory(map)
clearHistory(map)
map |
a map widget object created from
|
the new map
object
https://github.com/cscott530/leaflet-history
Other History Functions:
addHistory()
,
clearFuture()
,
goBackHistory()
,
goForwardHistory()
,
historyOptions()
Close the Sidebar
closeSidebar(map, sidebar_id = NULL)
closeSidebar(map, sidebar_id = NULL)
map |
A leaflet map widget |
sidebar_id |
The id of the sidebar (per |
the new map
object
Other Sidebar Functions:
addSidebar()
,
openSidebar()
,
removeSidebar()
,
sidebar_pane()
,
sidebar_tabs()
Adds options for clusterCharts
clusterchartOptions( rmax = 30, size = c(20, 20), width = 40, height = 50, strokeWidth = 1, innerRadius = 10, labelBackground = FALSE, labelFill = "white", labelStroke = "black", labelColor = "black", labelOpacity = 0.9, digits = 2, sortTitlebyCount = TRUE )
clusterchartOptions( rmax = 30, size = c(20, 20), width = 40, height = 50, strokeWidth = 1, innerRadius = 10, labelBackground = FALSE, labelFill = "white", labelStroke = "black", labelColor = "black", labelOpacity = 0.9, digits = 2, sortTitlebyCount = TRUE )
rmax |
The maximum radius of the clusters. |
size |
The size of the cluster markers. |
width |
The width of the bar-charts. |
height |
The height of the bar-charts. |
strokeWidth |
The stroke width of the chart. |
innerRadius |
The inner radius of pie-charts. |
labelBackground |
Should the label have a background? Default is 'FALSE' |
labelFill |
The label background color. Default is 'white' |
labelStroke |
The label stroke color. Default is 'black' |
labelColor |
The label color. Default is 'black' |
labelOpacity |
The label color. Default is '0.9' |
digits |
The amount of digits. Default is '2' |
sortTitlebyCount |
Should the svg-title be sorted by count or by the categories. |
Other clusterCharts:
addClusterCharts()
Print or export a map programmatically (e.g. in a Shiny environment).
easyprintMap(map, sizeModes = "A4Portrait", filename = "map")
easyprintMap(map, sizeModes = "A4Portrait", filename = "map")
map |
the map widget |
sizeModes |
Must match one of the given |
filename |
Name of the file if |
A leaflet map object
Other EasyPrint Functions:
addEasyprint()
,
easyprintOptions()
,
removeEasyprint()
## Only run examples in interactive R sessions if (interactive()) { library(shiny) library(leaflet) library(leaflet.extras2) 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) }) } shinyApp(ui, server) }
## Only run examples in interactive R sessions if (interactive()) { library(shiny) library(leaflet) library(leaflet.extras2) 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) }) } shinyApp(ui, server) }
Create a list of further options for the easyprint plugin.
easyprintOptions( title = "Print map", position = "topleft", sizeModes = list("A4Portrait", "A4Landscape", "CurrentSize"), defaultSizeTitles = NULL, exportOnly = FALSE, tileLayer = NULL, tileWait = 500, filename = "map", hidden = FALSE, hideControlContainer = TRUE, hideClasses = NULL, customWindowTitle = NULL, spinnerBgColor = "#0DC5C1", customSpinnerClass = "epLoader" )
easyprintOptions( title = "Print map", position = "topleft", sizeModes = list("A4Portrait", "A4Landscape", "CurrentSize"), defaultSizeTitles = NULL, exportOnly = FALSE, tileLayer = NULL, tileWait = 500, filename = "map", hidden = FALSE, hideControlContainer = TRUE, hideClasses = NULL, customWindowTitle = NULL, spinnerBgColor = "#0DC5C1", customSpinnerClass = "epLoader" )
title |
Sets the text which appears as the tooltip of the print/export button |
position |
Positions the print button |
sizeModes |
Either a character vector with one of the following options:
|
defaultSizeTitles |
Button tooltips for the default page sizes |
exportOnly |
If set to |
tileLayer |
The group name of one tile layer that you can wait for to draw (helpful when resizing) |
tileWait |
How long to wait for the tiles to draw (helpful when resizing) |
filename |
Name of the file if |
Set to |
|
hideControlContainer |
Hides the leaflet controls like the zoom buttons and the attribution on the print out |
hideClasses |
Use a character vector or list of CSS-classes to hide on the output image. |
customWindowTitle |
A title for the print window which will get added to the printed paper |
spinnerBgColor |
A valid css colour for the spinner background color |
customSpinnerClass |
A class for a custom css spinner to use while waiting for the print. |
A list of options for the 'easyprint' control
https://github.com/rowanwins/leaflet-easyPrint
Other EasyPrint Functions:
addEasyprint()
,
easyprintMap()
,
removeEasyprint()
The available GIBS layers with attributes
gibs_layers
gibs_layers
An object of class data.frame
with 276 rows and 4 columns.
If possible, will go to previous map extent. Pushes current extent to the "future" stack.
goBackHistory(map)
goBackHistory(map)
map |
a map widget object created from
|
the new map
object
https://github.com/cscott530/leaflet-history
Other History Functions:
addHistory()
,
clearFuture()
,
clearHistory()
,
goForwardHistory()
,
historyOptions()
If possible, will go to next map extent. Pushes current extent to the "back" stack.
goForwardHistory(map)
goForwardHistory(map)
map |
a map widget object created from
|
the new map
object
https://github.com/cscott530/leaflet-history
Other History Functions:
addHistory()
,
clearFuture()
,
clearHistory()
,
goBackHistory()
,
historyOptions()
Customize the heightgraph with the following additional options.
heightgraphOptions( position = c("bottomright", "topleft", "topright", "bottomleft"), width = 800, height = 200, margins = list(top = 10, right = 30, bottom = 55, left = 50), expand = TRUE, expandCallback = NULL, mappings = NULL, highlightStyle = list(color = "red"), translation = NULL, xTicks = 3, yTicks = 3 )
heightgraphOptions( position = c("bottomright", "topleft", "topright", "bottomleft"), width = 800, height = 200, margins = list(top = 10, right = 30, bottom = 55, left = 50), expand = TRUE, expandCallback = NULL, mappings = NULL, highlightStyle = list(color = "red"), translation = NULL, xTicks = 3, yTicks = 3 )
position |
position of control: "topleft", "topright", "bottomleft", or
"bottomright". Default is |
width |
The width of the expanded heightgraph display in pixels. Default
is |
height |
The height of the expanded heightgraph display in pixels.
Default is |
margins |
The margins define the distance between the border of the
heightgraph and the actual graph inside. You are able to specify margins
for top, right, bottom and left in pixels. Default is |
expand |
Boolean value that defines if the heightgraph should be
expanded on creation. Default is |
expandCallback |
Function to be called if the heightgraph is expanded or
reduced. The state of the heightgraph is passed as an argument. It is
|
mappings |
You may add a mappings object to customize the colors and
labels in the height graph. Without adding custom mappings the segments and
labels within the graph will be displayed in random colors. Each key of the
object must correspond to the |
highlightStyle |
You can customize the highlight style when using the
horizontal line to find parts of the route above an elevation value. Use
any Leaflet Path options as value of the highlightStyle parameter. Default
is |
translation |
You can change the labels of the heightgraph info field by
passing translations for |
xTicks |
Specify the tick frequency in the x axis of the graph.
Corresponds approximately to 2 to the power of value ticks. Default is
|
yTicks |
Specify the tick frequency in the y axis of the graph.
Corresponds approximately to 2 to the power of value ticks. Default is
|
A list of further options for addHeightgraph
Other Heightgraph Functions:
addHeightgraph()
A list of options for customizing the appearance/behavior of the hexbin layer.
hexbinOptions( duration = 200, colorScaleExtent = NULL, radiusScaleExtent = NULL, colorRange = c("#f7fbff", "#08306b"), radiusRange = c(5, 15), pointerEvents = "all", resizetoCount = FALSE, tooltip = "Count " )
hexbinOptions( duration = 200, colorScaleExtent = NULL, radiusScaleExtent = NULL, colorRange = c("#f7fbff", "#08306b"), radiusRange = c(5, 15), pointerEvents = "all", resizetoCount = FALSE, tooltip = "Count " )
duration |
Transition duration for the hexbin layer |
colorScaleExtent |
extent of the color scale for the hexbin layer. This
is used to override the derived extent of the color values and is specified
as a vector of the form c(min= numeric, max= numeric). Can be a numeric
vector or a custom |
radiusScaleExtent |
This is the same exact configuration option as colorScaleExtent, only applied to the radius extent. |
colorRange |
Sets the range of the color scale used to fill the hexbins on the layer. |
radiusRange |
Sets the range of the radius scale used to size the hexbins on the layer. |
pointerEvents |
This value is passed directly to an element-level css style for pointer-events. You should only modify this config option if you want to change the mouse event behavior on hexbins. This will modify when the events are propagated based on the visibility state and/or part of the hexbin being hovered. |
resizetoCount |
Resizes the hexbin to the count. Default is
|
tooltip |
Should tooltips be displayed? If set to |
A list of hexbin-specific options
Other Hexbin-D3 Functions:
addHexbin()
,
clearHexbin()
,
hideHexbin()
,
showHexbin()
,
updateHexbin()
Hide the hexbinLayer.
hideHexbin(map)
hideHexbin(map)
map |
The map widget |
the new map
object
Other Hexbin-D3 Functions:
addHexbin()
,
clearHexbin()
,
hexbinOptions()
,
showHexbin()
,
updateHexbin()
History Options
historyOptions( position = c("topright", "topleft", "bottomleft", "bottomright"), maxMovesToSave = 10, backImage = "fa fa-caret-left", forwardImage = "fa fa-caret-right", backText = "", forwardText = "", backTooltip = "Go to Previous Extent", forwardTooltip = "Go to Next Extent", backImageBeforeText = TRUE, forwardImageBeforeText = FALSE, orientation = c("horizontal", "vertical"), shouldSaveMoveInHistory = NULL )
historyOptions( position = c("topright", "topleft", "bottomleft", "bottomright"), maxMovesToSave = 10, backImage = "fa fa-caret-left", forwardImage = "fa fa-caret-right", backText = "", forwardText = "", backTooltip = "Go to Previous Extent", forwardTooltip = "Go to Next Extent", backImageBeforeText = TRUE, forwardImageBeforeText = FALSE, orientation = c("horizontal", "vertical"), shouldSaveMoveInHistory = NULL )
position |
Set the position of the History control. Default is
|
maxMovesToSave |
Number of moves in the history to save before clearing out the oldest. Default value is 10, use 0 or a negative number to make unlimited. |
backImage |
The class for the 'back' button icon. Default is
|
forwardImage |
The class for the 'forward' button icon. Default is
|
backText |
The text in the buttons. Default is ”. |
forwardText |
The text in the buttons. Default is ”. |
backTooltip |
Tooltip content. Default is |
forwardTooltip |
Tooltip content. Default is |
backImageBeforeText |
When both text and image are present, whether to
show the image first or the text first (left to right). Default is
|
forwardImageBeforeText |
When both text and image are present, whether
to show the image first or the text first (left to right). Default is
|
orientation |
Whether to position the buttons on top of one another or
side-by-side. Default is |
shouldSaveMoveInHistory |
A JS callback you can provide that gets called with every move. return false to not save a move. |
A list of further options for addHistory
https://github.com/cscott530/leaflet-history
Other History Functions:
addHistory()
,
clearFuture()
,
clearHistory()
,
goBackHistory()
,
goForwardHistory()
library(leaflet) leaflet() %>% addTiles() %>% addHistory(options = historyOptions( position = "bottomright", maxMovesToSave = 20, backText = "Go back", forwardText = "Go forward", orientation = "vertical" ))
library(leaflet) leaflet() %>% addTiles() %>% addHistory(options = historyOptions( position = "bottomright", maxMovesToSave = 20, backText = "Go back", forwardText = "Go forward", orientation = "vertical" ))
Is a map snychronized with any or a specific map?
Invoking this method sets a Shiny input that returns TRUE
when
the map is synchronized with another map. If syncwith
is
set, TRUE
is returned if the map is synchronized exactly
with that other map.
isSynced(map, id = NULL, syncwith = NULL)
isSynced(map, id = NULL, syncwith = NULL)
map |
the map |
id |
The map id |
syncwith |
Is the map synchronized with one of these maps? |
The Siny input name is combined of the map-id and "_synced"
.
For a map with id map1
the input can be retrieved with
input$map1_synced
.
A map
Other leafletsync Functions:
addLeafletsync()
,
addLeafletsyncDependency()
,
leafletsyncOptions()
,
unsync()
Additional list of options.
leafletsyncOptions( noInitialSync = FALSE, syncCursor = TRUE, offsetFn = JS("function (center, zoom, refMap, tgtMap) { return center; }") )
leafletsyncOptions( noInitialSync = FALSE, syncCursor = TRUE, offsetFn = JS("function (center, zoom, refMap, tgtMap) { return center; }") )
noInitialSync |
Setting to |
syncCursor |
The default |
offsetFn |
A JavaScript-function to compute an offset for the center. |
A list of options for addLeafletsync
Other leafletsync Functions:
addLeafletsync()
,
addLeafletsyncDependency()
,
isSynced()
,
unsync()
Make Mapkey Icon
makeMapkeyIcon( icon = "mapkey", color = "#ff0000", iconSize = 12, background = "#1F7499", borderRadius = "100%", hoverScale = 1.4, hoverEffect = TRUE, additionalCSS = NULL, hoverCSS = NULL, htmlCode = NULL, boxShadow = TRUE )
makeMapkeyIcon( icon = "mapkey", color = "#ff0000", iconSize = 12, background = "#1F7499", borderRadius = "100%", hoverScale = 1.4, hoverEffect = TRUE, additionalCSS = NULL, hoverCSS = NULL, htmlCode = NULL, boxShadow = TRUE )
icon |
ID of the mapkey Icon you want to use. |
color |
Any CSS color (e.g. 'red','rgba(20,160,90,0.5)', '#686868', ...) |
iconSize |
Size of Icon in Pixels. Default is 12 |
background |
Any CSS color or false for no background |
borderRadius |
Any number (for circle size/2, for square 0.001) |
hoverScale |
Any real number (best result in range 1 - 2, use 1 for no effect) |
hoverEffect |
Switch on/off effect on hover |
additionalCSS |
CSS code (e.g. |
hoverCSS |
CSS code (e.g. |
htmlCode |
e.g. |
boxShadow |
Should a shadow be visible |
A list of mapkey-icon data that can be passed to the argument icon
https://github.com/mapshakers/leaflet-mapkey-icon
Other Mapkey Functions:
[.leaflet_mapkey_icon_set()
,
addMapkeyMarkers()
,
mapkeyIconList()
,
mapkeyIcons()
makeMapkeyIcon( icon = "traffic_signal", color = "#0000ff", iconSize = 12, boxShadow = FALSE, background = "transparent" )
makeMapkeyIcon( icon = "traffic_signal", color = "#0000ff", iconSize = 12, boxShadow = FALSE, background = "transparent" )
Make Mapkey-icon set
mapkeyIconList(...)
mapkeyIconList(...)
... |
icons created from |
A list of class "leaflet_mapkey_icon_set"
https://github.com/mapshakers/leaflet-mapkey-icon
Other Mapkey Functions:
[.leaflet_mapkey_icon_set()
,
addMapkeyMarkers()
,
makeMapkeyIcon()
,
mapkeyIcons()
iconSet <- mapkeyIconList( red = makeMapkeyIcon(color = "#ff0000"), blue = makeMapkeyIcon(color = "#0000ff") ) iconSet[c("red", "blue")]
iconSet <- mapkeyIconList( red = makeMapkeyIcon(color = "#ff0000"), blue = makeMapkeyIcon(color = "#0000ff") ) iconSet[c("red", "blue")]
An icon can be represented as a list of the form list(color, iconSize,
...)
. This function is vectorized over its arguments to create a list of
icon data. Shorter argument values will be re-cycled. NULL
values for
these arguments will be ignored.
mapkeyIcons( icon = "mapkey", color = "#ff0000", iconSize = 12, background = "#1F7499", borderRadius = "100%", hoverScale = 1.4, hoverEffect = TRUE, hoverCSS = NULL, additionalCSS = NULL, htmlCode = NULL, boxShadow = TRUE )
mapkeyIcons( icon = "mapkey", color = "#ff0000", iconSize = 12, background = "#1F7499", borderRadius = "100%", hoverScale = 1.4, hoverEffect = TRUE, hoverCSS = NULL, additionalCSS = NULL, htmlCode = NULL, boxShadow = TRUE )
icon |
ID of the mapkey Icon you want to use. |
color |
Any CSS color (e.g. 'red','rgba(20,160,90,0.5)', '#686868', ...) |
iconSize |
Size of Icon in Pixels. Default is 12 |
background |
Any CSS color or false for no background |
borderRadius |
Any number (for circle size/2, for square 0.001) |
hoverScale |
Any real number (best result in range 1 - 2, use 1 for no effect) |
hoverEffect |
Switch on/off effect on hover |
hoverCSS |
CSS code (e.g. |
additionalCSS |
CSS code (e.g. |
htmlCode |
e.g. |
boxShadow |
Should a shadow be visible |
A list of mapkey-icon data that can be passed to the argument icon
https://github.com/mapshakers/leaflet-mapkey-icon
Other Mapkey Functions:
[.leaflet_mapkey_icon_set()
,
addMapkeyMarkers()
,
makeMapkeyIcon()
,
mapkeyIconList()
## Not run: library(leaflet) leaflet() %>% addMapkeyMarkers( data = breweries91, icon = mapkeyIcons( color = "red", borderRadius = 0, iconSize = 25 ) ) ## End(Not run)
## Not run: library(leaflet) leaflet() %>% addMapkeyMarkers( data = breweries91, icon = mapkeyIcons( color = "red", borderRadius = 0, iconSize = 25 ) ) ## End(Not run)
Set options for Moving Markers
movingMarkerOptions(autostart = FALSE, loop = FALSE, pauseOnZoom = FALSE)
movingMarkerOptions(autostart = FALSE, loop = FALSE, pauseOnZoom = FALSE)
autostart |
If |
loop |
if |
pauseOnZoom |
Pause the marker while zooming. While this improves the
animation, it is not recommended because the animation time is lost and
the marker will not appear at the correct time at the next station.
Default is |
A list of extra options for moving markers
https://github.com/ewoken/Leaflet.MovingMarker
Other MovingMarker Functions:
addMovingMarker()
,
startMoving()
Open the Sidebar by ID
openSidebar(map, id, sidebar_id = NULL, ns = NULL)
openSidebar(map, id, sidebar_id = NULL, ns = NULL)
map |
A leaflet map widget |
id |
The id of the |
sidebar_id |
The id of the sidebar (per |
ns |
The namespace function, if used in Shiny modules. |
the new map
object
Other Sidebar Functions:
addSidebar()
,
closeSidebar()
,
removeSidebar()
,
sidebar_pane()
,
sidebar_tabs()
openweatherCurrentOptions
openweatherCurrentOptions(lang = "en", minZoom = 7, interval = 10, ...)
openweatherCurrentOptions(lang = "en", minZoom = 7, interval = 10, ...)
lang |
'en', 'de', 'ru', 'fr', 'es', 'ca'. Language of popup texts. Note: not every translation is finished yet. |
minZoom |
Number (7). Minimal zoom level for fetching city data. Use smaller values only at your own risk. |
interval |
Number (0). Time in minutes to reload city data. Please do not use less than 10 minutes. |
... |
Further options passed to |
A list of options for addOpenweatherCurrent
Other Openweathermap Functions:
addOpenweatherCurrent()
,
addOpenweatherTiles()
,
openweatherOptions()
OpenWeatherMap Options
openweatherOptions( showLegend = TRUE, legendImagePath = NULL, legendPosition = c("bottomleft", "bottomright", "topleft", "topright") )
openweatherOptions( showLegend = TRUE, legendImagePath = NULL, legendPosition = c("bottomleft", "bottomright", "topleft", "topright") )
showLegend |
If |
legendImagePath |
A URL (is set to a default image for some layers, null for others, see below). URL or relative path to an image which is a legend to this layer |
legendPosition |
Position of the legend images on the map. Must be one
of |
A list of options for addOpenweatherTiles
Other Openweathermap Functions:
addOpenweatherCurrent()
,
addOpenweatherTiles()
,
openweatherCurrentOptions()
A list of options for addPlayback
. For a full list please visit
the plugin repository.
playbackOptions( color = "blue", radius = 5, tickLen = 250, speed = 50, maxInterpolationTime = 5 * 60 * 1000, tracksLayer = TRUE, playControl = TRUE, dateControl = TRUE, sliderControl = TRUE, orientIcons = FALSE, staleTime = 60 * 60 * 1000, transitionpopup = TRUE, transitionlabel = TRUE, ... )
playbackOptions( color = "blue", radius = 5, tickLen = 250, speed = 50, maxInterpolationTime = 5 * 60 * 1000, tracksLayer = TRUE, playControl = TRUE, dateControl = TRUE, sliderControl = TRUE, orientIcons = FALSE, staleTime = 60 * 60 * 1000, transitionpopup = TRUE, transitionlabel = TRUE, ... )
color |
colors of the CircleMarkers. |
radius |
a numeric value for the radius of the CircleMarkers. |
tickLen |
Set tick length in milliseconds. Increasing this value, may improve performance, at the cost of animation smoothness. Default is 250 |
speed |
Set float multiplier for default animation speed. Default is 50 |
maxInterpolationTime |
Set max interpolation time in milliseconds. Default is 5*60*1000 (5 minutes). |
tracksLayer |
Set |
playControl |
Set |
dateControl |
Set |
sliderControl |
Set |
orientIcons |
Set |
staleTime |
Set time before a track is considered stale and faded out. Default is 60*60*1000 (1 hour) |
transitionpopup |
Should the position of the popup move smoothly,
like the marker icon? Default: |
transitionlabel |
Should the position of the label move smoothly,
like the marker icon? Default: |
... |
Further arguments passed to 'L.Playback' |
A list of options for addPlayback
https://github.com/hallahan/LeafletPlayback
Other Playback Functions:
addPlayback()
,
removePlayback()
Add extra options. For a full list please visit the plugin repository.
reachabilityOptions( collapsed = TRUE, pane = "overlayPane", position = "topleft", ... )
reachabilityOptions( collapsed = TRUE, pane = "overlayPane", position = "topleft", ... )
collapsed |
Should the control widget start in a collapsed mode.
Default is |
pane |
Leaflet pane to add the isolines GeoJSON to.
Default is |
position |
Leaflet control pane position. Default is |
... |
Further arguments passed to 'L.Control.Reachability' |
A list of options for addReachability
https://github.com/traffordDataLab/leaflet.reachability
Other Reachability Functions:
addReachability()
,
removeReachability()
Remove one or more Antpaths from a map, identified by layerId
.
removeAntpath(map, layerId = NULL)
removeAntpath(map, layerId = NULL)
map |
a map widget object, possibly created from |
layerId |
character vector; the layer id(s) of the item to remove |
the new map
object
Other Antpath Functions:
addAntpath()
,
antpathOptions()
,
clearAntpath()
Remove arrowheads from Lines by layerId
removeArrowhead(map, layerId)
removeArrowhead(map, layerId)
map |
the map |
layerId |
A single layerId or a vector of layerId's |
A modified leaflet map
Other Arrowhead Functions:
addArrowhead()
,
arrowheadOptions()
,
clearArrowhead()
Removes the easyprint control from the map.
removeEasyprint(map)
removeEasyprint(map)
map |
the map widget |
A leaflet map object
Other EasyPrint Functions:
addEasyprint()
,
easyprintMap()
,
easyprintOptions()
Remove the Playback controls and markers.
removePlayback(map)
removePlayback(map)
map |
the map widget |
the new map
object
Other Playback Functions:
addPlayback()
,
playbackOptions()
Remove the reachability controls.
removeReachability(map)
removeReachability(map)
map |
the map widget. |
the new map
object
Other Reachability Functions:
addReachability()
,
reachabilityOptions()
Remove the Sidebar
removeSidebar(map, sidebar_id = NULL)
removeSidebar(map, sidebar_id = NULL)
map |
A leaflet map widget |
sidebar_id |
The id of the sidebar (per |
the new map
object
Other Sidebar Functions:
addSidebar()
,
closeSidebar()
,
openSidebar()
,
sidebar_pane()
,
sidebar_tabs()
removeSidebyside
removeSidebyside(map, layerId = NULL)
removeSidebyside(map, layerId = NULL)
map |
a map widget |
layerId |
the layer id of the |
the new map
object
Other Sidebyside Functions:
addSidebyside()
Remove the Timeslider controls and markers.
removeTimeslider(map)
removeTimeslider(map)
map |
the map widget |
the new map
object
Other Timeslider Functions:
addTimeslider()
,
timesliderOptions()
removeVelocity
removeVelocity(map, group)
removeVelocity(map, group)
map |
the map widget |
group |
the group to remove |
the new map
object
Other Velocity Functions:
addVelocity()
,
setOptionsVelocity()
,
velocityOptions()
Update the OSM-Buildings Data
setBuildingData(map, data)
setBuildingData(map, data)
map |
A map widget object created from |
data |
A GeoJSON object containing Polygon features representing the buildings. The properties of these polygons can include attributes like |
Other OSM-Buildings Plugin:
addBuildings()
,
setBuildingStyle()
,
updateBuildingTime()
Update the OSM-Buildings Style
setBuildingStyle( map, style = list(color = "#ffcc00", wallColor = "#ffcc00", roofColor = "orange", shadows = TRUE) )
setBuildingStyle( map, style = list(color = "#ffcc00", wallColor = "#ffcc00", roofColor = "orange", shadows = TRUE) )
map |
A map widget object created from |
style |
A named list of styles |
Other OSM-Buildings Plugin:
addBuildings()
,
setBuildingData()
,
updateBuildingTime()
library(leaflet) library(leaflet.extras2) style <- list(color = "#0000ff", wallColor = "gray", roofColor = "orange", shadows = TRUE) leaflet() %>% addTiles() %>% addBuildings() %>% setBuildingStyle(style) %>% setView(13.40, 52.51836, 15)
library(leaflet) library(leaflet.extras2) style <- list(color = "#0000ff", wallColor = "gray", roofColor = "orange", shadows = TRUE) leaflet() %>% addTiles() %>% addBuildings() %>% setBuildingStyle(style) %>% setView(13.40, 52.51836, 15)
Set a new date for multi-temporal layers.
setDate(map, layers = NULL, dates = NULL)
setDate(map, layers = NULL, dates = NULL)
map |
a map widget object created from |
layers |
A character vector of GIBS-layers. See |
dates |
Date object. If multiple |
the new map
object
Other GIBS Functions:
addGIBS()
,
setTransparent()
setOptionsVelocity
setOptionsVelocity(map, layerId, options)
setOptionsVelocity(map, layerId, options)
map |
the map widget |
layerId |
the layer id |
options |
see |
the new map
object
Other Velocity Functions:
addVelocity()
,
removeVelocity()
,
velocityOptions()
Change the transparency for no-data pixels.
setTransparent(map, layers = NULL, transparent = TRUE)
setTransparent(map, layers = NULL, transparent = TRUE)
map |
a map widget object created from |
layers |
A character vector of GIBS-layers. See |
transparent |
Should the layer be transparent. If multiple |
the new map
object
Other GIBS Functions:
addGIBS()
,
setDate()
Show the hexbinLayer.
showHexbin(map)
showHexbin(map)
map |
The map widget |
the new map
object
Other Hexbin-D3 Functions:
addHexbin()
,
clearHexbin()
,
hexbinOptions()
,
hideHexbin()
,
updateHexbin()
Create a Sidebar Pane
sidebar_pane( title = "Sidebar Title", id = NULL, icon = icon("caret-right"), ... )
sidebar_pane( title = "Sidebar Title", id = NULL, icon = icon("caret-right"), ... )
title |
A title for the sidebar panel |
id |
An id for the sidebar panel |
icon |
An icon for the sidebar panel |
... |
List of elements to include in the panel |
A shiny.tag
with sidebar-specific HTML classes
https://github.com/Turbo87/sidebar-v2, https://github.com/Turbo87/sidebar-v2/blob/master/doc/usage.md
Other Sidebar Functions:
addSidebar()
,
closeSidebar()
,
openSidebar()
,
removeSidebar()
,
sidebar_tabs()
## Not run: library(shiny) sidebar_pane(id = "id", icon = icon("cars"), tags$div()) ## End(Not run)
## Not run: library(shiny) sidebar_pane(id = "id", icon = icon("cars"), tags$div()) ## End(Not run)
Create a Sidebar
sidebar_tabs(id = "sidebar", iconList = NULL, ...)
sidebar_tabs(id = "sidebar", iconList = NULL, ...)
id |
The id of the sidebar, which must match the |
iconList |
A list of icons to be shown, when the sidebar is collapsed.
The list is required and must match the amount of |
... |
The individual |
A shiny.tag
with individual sidebar panes
https://github.com/Turbo87/sidebar-v2, https://github.com/Turbo87/sidebar-v2/blob/master/doc/usage.md
Other Sidebar Functions:
addSidebar()
,
closeSidebar()
,
openSidebar()
,
removeSidebar()
,
sidebar_pane()
## Not run: library(shiny) # run example app showing a single sidebar 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" )) ## End(Not run)
## Not run: library(shiny) # run example app showing a single sidebar 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" )) ## End(Not run)
The marker begins its path or resumes if it is paused.
startMoving(map, layerId = NULL) stopMoving(map, layerId = NULL) pauseMoving(map, layerId = NULL) resumeMoving(map, layerId = NULL) addLatLngMoving(map, layerId = NULL, latlng, duration) moveToMoving(map, layerId = NULL, latlng, duration) addStationMoving(map, layerId = NULL, pointIndex, duration)
startMoving(map, layerId = NULL) stopMoving(map, layerId = NULL) pauseMoving(map, layerId = NULL) resumeMoving(map, layerId = NULL) addLatLngMoving(map, layerId = NULL, latlng, duration) moveToMoving(map, layerId = NULL, latlng, duration) addStationMoving(map, layerId = NULL, pointIndex, duration)
map |
The leafletProxy object |
layerId |
You can pass a string or a vector of strings for the moving markers that you want to address. If none is specified, the action will be applied to all moving markers. |
latlng |
Coordinates as list (e.g.: |
duration |
Duration in milliseconds |
pointIndex |
Index of a certain point |
the new map
object
stopMoving()
: Manually stops the marker, if you call start
after, the marker starts again the polyline at the beginning.
pauseMoving()
: Pauses the marker
resumeMoving()
: The marker resumes its animation
addLatLngMoving()
: Adds a point to the polyline.
Useful, if we have to set the path one by one.
moveToMoving()
: Stop the current animation and make the marker move
to latlng
in duration
ms.
addStationMoving()
: The marker will stop at the pointIndex
point
of the polyline for duration
milliseconds. You can't add a station
at the first or last point of the polyline.
https://github.com/ewoken/Leaflet.MovingMarker
Other MovingMarker Functions:
addMovingMarker()
,
movingMarkerOptions()
A list of options for addTimeslider
.
timesliderOptions( position = c("topright", "bottomleft", "bottomright", "topleft"), timeAttribute = "time", isEpoch = FALSE, startTimeIdx = 0, timeStrLength = 19, maxValue = -1, minValue = 0, showAllOnStart = FALSE, range = FALSE, follow = FALSE, alwaysShowDate = FALSE, rezoom = NULL, sameDate = FALSE )
timesliderOptions( position = c("topright", "bottomleft", "bottomright", "topleft"), timeAttribute = "time", isEpoch = FALSE, startTimeIdx = 0, timeStrLength = 19, maxValue = -1, minValue = 0, showAllOnStart = FALSE, range = FALSE, follow = FALSE, alwaysShowDate = FALSE, rezoom = NULL, sameDate = FALSE )
position |
position of control: "topleft", "topright", "bottomleft", or
"bottomright". Default is |
timeAttribute |
The column name of the time property.
Default is |
isEpoch |
whether the time attribute is seconds elapsed from epoch.
Default is |
startTimeIdx |
where to start looking for a timestring
Default is |
timeStrLength |
the size of |
maxValue |
Set the maximum value of the slider. Default is |
minValue |
Set the minimum value of the slider. Default is |
showAllOnStart |
Specify whether all markers should be initially visible.
Default is |
range |
To use a range-slider, set to |
follow |
To display only the markers at the specific timestamp specified
by the slider. Specify a value of 1 (or true) to display only a single data
point at a time, and a value of null (or false) to display the current marker
and all previous markers. The range property overrides the follow property.
Default is |
alwaysShowDate |
Should the Date always be visible. Default is |
rezoom |
Use the rezoom property to ensure the markers being displayed
remain in view. Default is |
sameDate |
Show only data with the current selected time.
Default is |
A list of options for addTimeslider
https://github.com/dwilhelm89/LeafletSlider
Other Timeslider Functions:
addTimeslider()
,
removeTimeslider()
to_jsonformat Transform object to JSON expected format
to_jsonformat(data, time, popup = NULL, label = NULL, name = NULL)
to_jsonformat(data, time, popup = NULL, label = NULL, name = NULL)
data |
The data |
time |
Name of the time column. |
popup |
Name of the popup column. |
label |
Name of the label column. |
name |
Name of the name column. |
A list that is transformed to the expected JSON format
to_ms Change POSIX or Date to milliseconds
to_ms(data, time)
to_ms(data, time)
data |
The data |
time |
Name of the time column. |
A data.frame with the time column in milliseconds
Removes the synchronization of multiple maps from a specific map.
unsync(map, id = NULL, unsyncids = NULL)
unsync(map, id = NULL, unsyncids = NULL)
map |
the map |
id |
The map id from which to unsynchronize the maps in |
unsyncids |
Unsynchronize the maps with the following IDs |
A map
Other leafletsync Functions:
addLeafletsync()
,
addLeafletsyncDependency()
,
isSynced()
,
leafletsyncOptions()
Update the Shadows OSM-Buildings with a POSIXct timestamp
updateBuildingTime(map, time)
updateBuildingTime(map, time)
map |
A map widget object created from |
time |
a timestamp that can be converted to POSIXct |
Other OSM-Buildings Plugin:
addBuildings()
,
setBuildingData()
,
setBuildingStyle()
library(leaflet) library(leaflet.extras2) leaflet() %>% addTiles() %>% addBuildings() %>% updateBuildingTime(as.POSIXct("2024-09-01 19:00:00 CET")) %>% setView(13.40, 52.51836, 15)
library(leaflet) library(leaflet.extras2) leaflet() %>% addTiles() %>% addBuildings() %>% updateBuildingTime(as.POSIXct("2024-09-01 19:00:00 CET")) %>% setView(13.40, 52.51836, 15)
Dynamically change the data
and/or the colorRange
.
updateHexbin(map, data = NULL, lng = NULL, lat = NULL, colorRange = NULL)
updateHexbin(map, data = NULL, lng = NULL, lat = NULL, colorRange = NULL)
map |
a map widget object created from |
data |
the data object from which the argument values are derived; by
default, it is the |
lng |
a numeric vector of longitudes, or a one-sided formula of the form
|
lat |
a vector of latitudes or a formula (similar to the |
colorRange |
The range of the color scale used to fill the hexbins |
the new map
object
Other Hexbin-D3 Functions:
addHexbin()
,
clearHexbin()
,
hexbinOptions()
,
hideHexbin()
,
showHexbin()
Define further options for the velocity layer.
velocityOptions( speedUnit = c("m/s", "k/h", "kt"), minVelocity = 0, maxVelocity = 10, velocityScale = 0.005, colorScale = NULL, ... )
velocityOptions( speedUnit = c("m/s", "k/h", "kt"), minVelocity = 0, maxVelocity = 10, velocityScale = 0.005, colorScale = NULL, ... )
speedUnit |
Could be 'm/s' for meter per second, 'k/h' for kilometer per hour or 'kt' for knots |
minVelocity |
velocity at which particle intensity is minimum |
maxVelocity |
velocity at which particle intensity is maximum |
velocityScale |
scale for wind velocity |
colorScale |
A vector of hex colors or an RGB matrix |
... |
Further arguments passed to the Velocity layer and Windy.js. For more information, please visit leaflet-velocity plugin |
A list of further options for addVelocity
Other Velocity Functions:
addVelocity()
,
removeVelocity()
,
setOptionsVelocity()