View source: R/addAreaPolygons.R
addAreaPolygons | R Documentation |
This function adds a polygon area to a given map using the specified latitude and longitude coordinates.
addAreaPolygons(map, longitude, latitude, coordinate = "WGS-84")
map |
The map object to which the polygons will be added. |
longitude |
A vector of longitudes. |
latitude |
A vector of latitudes. |
coordinate |
A string indicating the coordinate system of the input data. Options are "WGS-84", "GCJ-02", "BD-09". |
The updated map object with added polygons.
library(leaflet)
m <- leaflet() %>% addTilesAmap()
m <- addAreaPolygons(m,
longitude = c(121.0, 122.1, 121.2, 122.15, 121.2),
latitude = c(31.1, 31.919, 31.917, 31.15, 31.12), coordinate = "WGS-84"
)
m
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.