leaflet_map | R Documentation |
Primarily designed to work with rgeo()
to display randomly sampled
points on the globe.
leaflet_map(
latitude = NULL,
longitude = NULL,
position = NULL,
zoom = 12,
mark = FALSE,
radius = 0,
units = c("km", "miles", "meters", "feet"),
...
)
latitude , longitude |
vectors of latitude and longitude values.
If |
position |
a data frame containing latitude and longitude positions |
zoom |
zoom level for initial map (1-20) |
mark |
a logical indicating whether the location should be marked with a pin |
radius |
a vector of radii of circles (in miles) centered at position that are displayed on the map |
units |
units for radii of circles (km, miles, meters, or feet). |
... |
additional arguments passed to |
a leaflet map
deg2rad()
, latlon2xyz()
and rgeo()
.
# the leaflet package is required
if (require(leaflet)) {
# Times Square
leaflet_map(40.7566, -73.9863, radius = 1, units = "miles")
# 3 random locations; 5 km circles
leaflet_map(position = rgeo(3), radius = 5, mark = TRUE, color = "red")
# using pipes
rgeo(4, latlim = c(25,50), lonlim = c(-65, -125)) |>
leaflet_map(radius = 5, mark = TRUE, color = "purple")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.