getBBox: Get a sf::bbox object based on another object

View source: R/getBBox.R

getBBoxR Documentation

Get a sf::bbox object based on another object

Description

Function to get a sf::bbox object based on another object.

Usage

getBBox(obj, crs = NULL)

Arguments

obj
  • an object that can be converted to a bbox, or from which one can be extracted

crs
  • an object that can be converted to a sf::crs object using get_crs(crs)

Details

obj=NULL returns a bbox for the Earth in degrees, with WGS84 as crs. Otherwise, obj can be:

  • a 4-element vector with values xmin, ymin, xmax, ymax

  • a 2x2 matrix with xmin, ymin on first row, xmax, ymax on second row

  • a list with sub-list elements bottomleft=c(xmin,ymin) and topright=c(xmax,ymax)

  • an object on which sf::st_bbox(obj) can be called

crs is ignored unless obj is a vector, matrix or a list; it is taken directly from obj.

Value

a sf::bbox object (numeric vector of class "bbox" with xmin, ymin, xmax, ymax and a sf::crs as an attribute)


wStockhausen/wtsGIS documentation built on Aug. 23, 2023, 2:31 a.m.