ext2spy: Convert Spatial Extent to Polygon

View source: R/ext2spy.R

ext2spyR Documentation

Convert Spatial Extent to Polygon

Description

Convert a spatial extent to polygons.

Usage

ext2spy(x, crs = "EPSG:4326", as_sf = TRUE)

Arguments

x

A SpatExtent object, or any object from which such an object can be extracted, e.g. SpatRaster.

crs

Coordinate reference system set via terra::crs().

as_sf

logical. If TRUE (default), the returned object is of class sf rather than Spatial*.

Value

Depending on 'as_sf', either a c(sf, data.frame) or SpatVector object.

Author(s)

Florian Detsch

See Also

terra::ext().

Examples

ext = terra::ext(c(25, 70, -5, 30))
ext2spy(ext) # 'sf' (default)
ext2spy(ext, as_sf = FALSE) # 'Spatial*'


Orcs documentation built on Jan. 6, 2023, 5:14 p.m.