Add Geodesic Lines
Add Geodesic Lines
addGeodesicPolylines(map, lng = NULL, lat = NULL, layerId = NULL, group = NULL, steps = 10, wrap = TRUE, stroke = TRUE, color = "#03F", weight = 5, opacity = 0.5, dashArray = NULL, smoothFactor = 1, noClip = FALSE, popup = NULL, popupOptions = NULL, label = NULL, labelOptions = NULL, options = pathOptions(), highlightOptions = NULL, data = getMapData(map)) addGreatCircles(map, lat_center = NULL, lng_center = NULL, radius, layerId = NULL, group = NULL, steps = 10, wrap = TRUE, stroke = TRUE, color = "#03F", weight = 5, opacity = 0.5, dashArray = NULL, smoothFactor = 1, noClip = FALSE, popup = NULL, popupOptions = NULL, label = NULL, labelOptions = NULL, options = pathOptions(), highlightOptions = NULL, data = getMapData(map))
map |
map object |
lng |
vector of longitudes |
lat |
vector of latitudes |
layerId |
the layer id |
group |
the name of the group this raster image should belong to (see |
steps |
Defines how many intermediate points are generated along the path. More steps mean a smoother path. |
wrap |
Wrap line at map border (date line). Set to "false" if you want lines to cross the dateline (experimental, see noWrap-example on how to use) |
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) |
dashArray |
a string that defines the stroke dash pattern |
smoothFactor |
how much to simplify the polyline on each zoom level |
noClip |
whether to disable polyline clipping (more means better performance and less accurate representation) |
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 additional options, intended to be provided by
a call to |
highlightOptions |
Options for highlighting the shape on mouse over. |
data |
map data |
lat_center, lng_center |
lat/lng for the center |
radius |
in meters |
addGreatCircles
: Adds a Great Circle to the map
berlin <- c(52.51, 13.4) losangeles <- c(34.05, -118.24) santiago <- c(-33.44, -70.71) tokio <- c(35.69, 139.69) sydney <- c(-33.91, 151.08) capetown <- c(-33.91, 18.41) calgary <- c(51.05, -114.08) hammerfest <- c(70.67, 23.68) barrow <- c(71.29, -156.76) df <- as.data.frame(rbind(hammerfest, calgary, losangeles, santiago, capetown, tokio, barrow)) names(df) <- c("lat","lng") leaflet(df) %>% addProviderTiles(providers$CartoDB.Positron) %>% addGeodesicPolylines(lng = ~lng, lat = ~lat, weight = 2, color = "red", steps = 50, opacity = 1) %>% addCircleMarkers(df, lat = ~lat,lng = ~lng, radius = 3, stroke = FALSE, fillColor = "black", fillOpacity = 1) ## for more examples see # browseURL(system.file("examples/geodesic.R", package = "leaflet.extras"))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.