Learn R Programming

inlmisc (version 0.3.2)

CreateWebMap: Create a Web Map Using The National Map Services

Description

This function creates a Leaflet map widget with base maps offered through The National Map (TNM). Information about the content of these base maps can be found within the TNM Base Maps document.

Usage

CreateWebMap(..., collapsed = TRUE)

Arguments

...

Leaflet options to be passed to the leafletOptions function.

collapsed

'logical'. If true, the layers control will be rendered as an icon that expands when hovered over.

Value

Returns a 'leaflet' Hypertext Markup Language (HTML) widget object with TNM base maps. See example for instructions on how to add additional graphic layers to the map widget.

Details

A number of map services are offered through TNM. There are no use restrictions on these services. However, map content is limited to the United States and Territories. This function integrates TNM services within an interactive web map using Leaflet for R.

See Also

addWMSTiles

Examples

Run this code
# NOT RUN {
map <- CreateWebMap()

lng <- c(-112.049705, -122.171257, -77.367458, -149.803565, -80.248344)
lat <- c(43.517810, 37.456526, 38.947206, 61.187905, 26.080860)
pop <- c("ID", "CA", "VA", "AK", "FL")
map <- leaflet::addMarkers(map, lng, lat, popup = pop)

map

# }

Run the code above in your browser using DataLab