Learn R Programming

inlmisc (version 0.4.3)

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(maps, ..., collapsed = TRUE)

Arguments

maps

'character'. Vector of TNM base maps to include in the web map. Possible maps include "Topo", "Imagery", "Imagery Topo", "Hydrography", and "Hill Shade". All base maps are included by default.

...

Arguments to be passed to the leaflet 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 (such as points, lines, and polygons) to the map widget. Graphic layers added to the web map must be in latitude and longitude using WGS 84 (also known as EPSG:4326).

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

AddWebMapElements

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)
map <- leaflet::addMarkers(map, lng, lat)
map

# }

Run the code above in your browser using DataLab