CreateWebMap: Create a Web Map Using TNM Services

View source: R/CreateWebMap.R

CreateWebMapR Documentation

Create a Web Map Using TNM Services

Description

Create 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, service = c("rest", "wms"))

Arguments

maps

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

...

Arguments to be passed to the leaflet function.

collapsed

'logical' flag. Whether the layers control should be rendered as an icon that expands when hovered over.

service

'character' string. Mapping services for accessing TNM base-map tiles. Select "rest" for representational state transfer services (the default) and "wms" for web map services.

Details

Map service endpoints are offered through TNM with no use restrictions. However, map content is limited to the United States and territories. This function integrates TNM endpoint services within an interactive web map using Leaflet for R.

Value

An object of class 'leaflet', a hypertext markup language (HTML) widget object. 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).

Author(s)

J.C. Fisher, U.S. Geological Survey, Idaho Water Science Center

See Also

AddWebMapElements

Examples

map <- CreateWebMap(collapsed = FALSE)
ll <- rbind(c(-112.049705, 43.517810),
            c(-122.171257, 37.456526),
            c( -77.367458, 38.947206),
            c(-149.803565, 61.187905),
            c( -80.248344, 26.080860))
map <- leaflet::addMarkers(map, ll[, 1], ll[, 2])
map


USGS-R/inlmisc documentation built on Sept. 17, 2022, 2:38 a.m.