Skip to contents

Create an rstac compatible search boundary box

Usage

rstac_bbox(x)

# S3 method for class 'sf'
rstac_bbox(x)

# S3 method for class 'sfc'
rstac_bbox(x)

# S3 method for class 'stars'
rstac_bbox(x)

# S3 method for class 'SpatRaster'
rstac_bbox(x)

# S3 method for class 'SpatVector'
rstac_bbox(x)

# S3 method for class 'numeric'
rstac_bbox(x)

Arguments

x

A numeric (length 4) to define the spatial bounds of the STAC API query or one of the following rspatial objects: sf, sfc, stars, SpatVector, SpatRaster

Value

A numeric of length 4 defining the xmin, ymin, xmax ymax coordinates of the search extent in WGS84 (EPSG:4326).

Examples

rstac_bbox(c(-121.772, 45.321, -121.611, 45.419))
#>     xmin     ymin     xmax     ymax 
#> -121.772   45.321 -121.611   45.419 

if (requireNamespace("sf", quietly = TRUE)) {
  nc_sf <- system.file("gpkg", "nc.gpkg", package = "sf") |>
    sf::read_sf()
  rstac_bbox(nc_sf)
}
#>      xmin      ymin      xmax      ymax 
#> -84.32377  33.88216 -75.45658  36.58977