This function produces an interactive view of the extent/bbox of the supplied spatial object
Usage
viewExtent(
x,
map = NULL,
popup = NULL,
layer.name = NULL,
alpha.regions = 0.2,
label = NULL,
...
)Arguments
- x
either a Raster*, sf* or Spatial* object
- map
a leaflet or mapview map the extent should be added to. If NULL standard background layers are created.
- popup
a
listof HTML strings with the popup contents, usually created frompopupTable. SeeaddControlfor details.- layer.name
the name of the layer to be shown on the map.
- alpha.regions
opacity of the fills or the raster layer(s).
- label
a character vector of labels to be shown on mouseover. See
addControlfor details.- ...
Arguments passed on to
leaflet::addRectangleslayerIdthe layer id
datathe data object from which the argument values are derived; by default, it is the
dataobject provided toleaflet()initially, but can be overriddengroupthe name of the group the newly created layers should belong to (for
clearGroup()andaddLayersControl()purposes). Human-friendly group names are permitted–they need not be short, identifier-style names. Any number of layers and even different types of layers (e.g., markers and polygons) can share the same group name.optionsa list of extra options for tile layers, popups, paths (circles, rectangles, polygons, ...), or other map elements
popupOptionsA Vector of
popupOptions()to provide popupslabelOptionsA Vector of
labelOptions()to provide label options for each label. DefaultNULLstrokewhether to draw stroke along the path (e.g., the borders of polygons or circles)
colorstroke color
weightstroke width in pixels
opacitystroke opacity (or layer opacity for tile layers)
fillwhether to fill the path with color (e.g., filling on polygons or circles)
fillColorfill color
fillOpacityfill opacity
dashArraya string that defines the stroke dash pattern
highlightOptionsOptions for highlighting the shape on mouse over.
smoothFactorhow much to simplify the polyline on each zoom level (more means better performance and less accurate representation)
noClipwhether to disable polyline clipping
lng1,lat1,lng2,lat2latitudes and longitudes of the south-west and north-east corners of rectangles
Examples
library(leaflet)
viewExtent(breweries)
viewExtent(franconia) + breweries
mapview(franconia) %>% leafem::addExtent(franconia, fillColor = "yellow")
leaflet() %>% addProviderTiles("OpenStreetMap") %>% leafem::addExtent(breweries)
leaflet() %>% addProviderTiles("OpenStreetMap") %>% leafem::addExtent(breweries)