add_home_button {webmap}R Documentation

Add home button to a web map

Description

Add a button to a Leaflet map that zooms to the provided map extent.

Usage

add_home_button(map, extent = NULL, position = "topleft")

Arguments

map

'leaflet'. Map widget object

extent

'bbox', or 'numeric' vector of length four, with xmin, xmax, ymin and ymax values. Extent object representing a rectangular geographical area on the map. The extent must be specified in the coordinate reference system (CRS) of the web map, usually in latitude and longitude using WGS 84 (also known as EPSG:4326). By default, the extent will be automatically determined from latitudes and longitudes of the map elements.

position

'character' string. Position of the button on the web map. Possible values are "topleft", "topright", "bottomleft", and "bottomright".

Value

A new HTML web map with added element, an object of class 'leaflet'.

Author(s)

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

See Also

make_map function for creating a map widget.

Examples

make_map(maps = "Topo") |>
  add_home_button(
    extent = c(-124.409, -114.131, 32.534, 42.009) # California
  )

[Package webmap version 1.1.0 Index]