Mapping Hurricanes Data II
Leaflet is a JavaScript library used to build interactive maps for websites and web mapping applications.
The R package "leaflet"
lets you create and customize Leaflet maps in R.
These maps can be used directly from the R console, from RStudio, in Markdown documents (e.g. qmd
, Rmd
), and in Shiny applications.
You create a Leaflet map with these basic steps:
Create a map widget by calling leaflet()
.
Add layers (i.e. features) to the map by using layer functions (e.g. addTiles
, addMarkers
, addPolygons
) to modify the map widget.
Repeat step 2 as desired.
Print the map widget to display it.
Leaflet uses map tiles from:
OpenStreetMap (OSM): https://www.openstreetmap.org/
CartoDB: https://carto.com/basemaps/
Both leaflet()
and the map layer functions have an optional data
parameter that is designed to receive spatial data in one of several forms:
"sf"
package:
"sf"
"maps"
package
map()
"sf"
data polygons