Learn R Programming

inlmisc (version 0.5.5)

CreateWebMap: 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.

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).

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.

See Also

AddWebMapElements

Examples

Run this code
# NOT RUN {
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

# }

Run the code above in your browser using DataLab