Learn R Programming

Orcs (version 1.2.3)

ext2spy: Convert Spatial Extent to Polygon

Description

Convert a spatial extent to polygons.

Usage

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

Value

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

object.

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*.

Author

Florian Detsch

See Also

Examples

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

Run the code above in your browser using DataLab