Learn R Programming

terra (version 0.5-2)

crs: Get or set a coordinate reference system (projection)

Description

Get or set the coordinate reference system (CRS) of a SpatRaster object.

Usage

# S4 method for SpatRaster
crs(x)
# S4 method for SpatVector
crs(x)
# S4 method for SpatRaster
crs(x, ...)<-value
# S4 method for SpatVector
crs(x, ...)<-value

Arguments

x

SpatRaster

value

character string describing a coordinate reference system in the PROJ.4 "+" format

...

additional arguments (none implemented)

Value

character or modified SpatRaster

Examples

Run this code
# NOT RUN {
r <- rast()
crs(r)
crs(r) <- "+proj=lcc +lat_1=48 +lat_2=33 +lon_0=-100 +ellps=WGS84"
crs(r)
# }

Run the code above in your browser using DataLab