Learn R Programming

enmSdmX (version 1.2.12)

spatVectorToSpatial: Convert SpatVector to Spatial*

Description

This function converts a SpatVector object from the terra package to a Spatial object of the appropriate class (SpatialPoints, SpatialPointsDataFrame, SpatialPolygons, or SpatialPolygonsDataFrame) from the sp package. Note that sp is to be retired in 2023, so this function is to be come useful only for legacy applications.

Usage

spatVectorToSpatial(x)

Value

Object of class Spatial.

Arguments

x

SpatVector object.

Examples

Run this code

library(terra)
f <- system.file('ex/lux.shp', package='terra')
v <- vect(f)
spat <- spatVectorToSpatial(v)
class(spat)

Run the code above in your browser using DataLab