Learn R Programming

⚠️There's a newer version (1.7-83) of this package.Take me there.

terra (version 1.5-21)

Spatial Data Analysis

Description

Methods for spatial data analysis with raster and vector data. Raster methods allow for low-level data manipulation as well as high-level global, local, zonal, and focal computation. The predict and interpolate methods facilitate the use of regression type (interpolation, machine learning) models for spatial prediction, including with satellite remote sensing data. Processing of very large files is supported. See the manual and tutorials on to get started. 'terra' is very similar to the 'raster' package; but 'terra' can do more, is easier to use, and it is faster.

Copy Link

Version

Install

install.packages('terra')

Monthly Downloads

183,196

Version

1.5-21

License

GPL (>= 3)

Maintainer

Last Published

February 17th, 2022

Functions in terra (1.5-21)

align

Align a SpatExtent
adjacent

Adjacent cells
RGB

Layers representing colors
SpatRaster-class

SpatRaster class
SpatExtent-class

Class "SpatExtent"
SpatVector-class

Class "SpatVector"
all.equal

Compare two SpatRasters for equality
add

Add (in place) a SpatRaster to another SpatRaster object
NAflag

Set the NA flag
Arith-methods

Arithmetic
activeCat

Active category
aggregate

Aggregate raster or vector data
as.character

Create a text representation of (the skeleton of) an object
c

Combine SpatRaster or SpatVector objects
as.raster

Coerce to a "raster" object
animate

Animate a SpatRaster
app

Apply a function to the cells of a SpatRaster
boundaries

Detect boundaries (edges)
as.data.frame

SpatRaster or SpatVector to data.frame
barplot

Bar plot of a SpatRaster
Compare-methods

Compare and logical methods
extend

Extend
compareGeom

Compare geometries of SpatRasters
clamp

Clamp values
classify

Classify (or reclassify) cell values
as.list

SpatRaster or SpatVector to list
boxplot

Box plot of SpatRaster data
as.spatvector

Conversion to a SpatVector, or to another SpatVector type
buffer

Create a buffer around vector geometries or raster patches
approximate

Estimate values for cell values that are NA by interpolating between layers
cartogram

Cartogram
catalyze

Factors to numeric
click

Query by clicking on a map
crs

Get or set a coordinate reference system
coerce

Coercion of a SpatRaster to a vector, matrix or array
cellSize

Area covered by each raster cell
density

Density plot
crop

Cut out a geographic subset
tighten

tighten SpatRaster or SpatRasterDataset objects
densify

Add additional nodes to lines or polygons
diff

Lagged differences
atan2

Two argument arc-tangent
draw

Draw a polygon, line, extent, or points
crosstab

Cross-tabulate
erase

Erase parts of a SpatVector object
extract

Extract values from a SpatRaster
focalValues

Get focal values
freq

Frequency table
makeTiles

Make tiles
lines

Add SpatVector data to a map
distance

Geographic distance
colors

Color table
dots

Make a dot-density map
convHull

Convex hull and minimal rotated rectangle
contour

Contour plot
fillTime

Fill time gaps in a SpatRaster
focalReg

Focal regression
focalMat

Focal weights matrix
inset

Make an inset map
modal

modal value
mosaic

mosaic SpatRasters
inplace

Change values in-place
direction

Direction
flip

Flip or reverse a raster
deepcopy

Deep copy
autocorrelation

Spatial autocorrelation
centroids

Get centroids
Spatial interpolation

Interpolate
intersect

Intersection
cells

Get cell numbers
match

Value matching for SpatRasters
crds

Get the coordinates of SpatVector geometries or SpatRaster cells
describe

describe
depth

depth of SpatRaster layers
cover

Replace values with values from another object
focal

Focal values
focal3D

Three-dimensional focal values
gaps

Find gaps between polygons
persp

Perspective plot
gdal

GDAL version, supported file formats, and cache size
nearest

nearby geometries
north

North arrow
focalCor

Focal function across two layers
impose

Impose the geometry of a SpatRaster to those in a SpatRasterCollection.
Math-methods

General mathematical methods
factors

Categorical rasters
global

global statistics
ext

Create, get or set a SpatExtent
expanse

Get the expanse (area) of individual polygons or for all (summed) raster cells
layerCor

Correlation and (weighted) covariance
disagg

Disaggregate raster cells or vector geometries
initialize

Initialize a SpatRaster with values
linearUnits

Linear units of the coordinate reference system
makeVRT

Make a VRT header file
gridDistance

Distance on a grid
geom

Get the geometry (coordinates) of a SpatVector
valid

Check or fix polygon validity
sel

Spatial selection
fillHoles

Remove holes from polygons
focalCpp

Compute focal values with an iterating C++ function
mem

Memory available and needed
merge

Merge SpatRaster or SpatExtent objects, or a SpatVector with a data.frame
lapp

Apply a function to layers of a SpatRaster, or sub-datasets of a SpatRasterDataset
project

Change the coordinate reference system
patches

Detect patches (clumps) of cells
quantile

Quantiles of spatial data
plot

Make a map
na.omit

na.omit for SpatVector
geomtype

Geometry type of a SpatVector
mask

Mask values in a SpatRaster or SpatVector
rep

Replicate layers
sds

Create a SpatRasterDataset
read and write

Read from, or write to, file
image

SpatRaster image method
relate

relate
ifel

ifelse for SpatRasters
rectify

rectify a SpatRaster
head and tail

Show the head or tail of a Spat* object
vector-attributes

Get or replace attribute values of a SpatVector
selectHighest

select cells with high or low values
names

Names of Spat* objects
rapp

Range-Apply
query

Query a SpatVectorProxy object
replace

Replace values of a SpatRaster
resample

Transfer values of a SpatRaster to another one with a different geometry
shift

Shift
is.bool

Raster value types
stretch

Stretch
is.lonlat

Check for longitude/latitude crs
hist

Histogram
spin

spin a SpatVector
rescale

rescale
sources

Data sources of a SpatRaster
segregate

segregate
subset-vector

Subset of a SpatVector
text

Add labels to a map
weighted.mean

Weighted mean of layers
time

time of SpatRaster layers
which.lyr

Which cells are TRUE?
units

units of SpatRaster or SpatRasterDataSet
values

Cell values and geometry attributes
predict

Spatial model predictions
perim

Perimeter or length
mergeTime

merge SpatRasters by timelines to create a single timeseries
plotRGB

Red-Green-Blue plot of a multi-layered SpatRaster
origin

Origin
extremes

Get or compute the minimum and maximum cell values
simplifyGeom

simplifyGeom geometries
writeRaster

Write raster data to a file
writeVector

Write SpatVector data to a file
symdif

Symetrical difference
svc

Create a SpatVectorCollection
pairs

Pairs plot (matrix of scatterplots)
rast

Create a SpatRaster
rasterize

Rasterize vector data
spatSample

Take a regular sample
subset

Subset of a SpatRaster
scale

Scale values
scatterplot

Scatterplot of two SpatRaster layers
summarize

Summarize
sapp

Apply a terra function that takes only a single layer and returns a SpatRaster to all layers of a SpatRaster
rotate

Rotate a SpatRaster along longitude
sbar

scale bar
subst

replace cell values
union

Union SpatVector or SpatExtent objects
setValues

Set the values of raster cells or of geometry attributes
unique

Unique values
shade

Hill shading
sharedPaths

Shared paths
sprc

Create a SpatRasterCollection
width

SpatVector geometric properties
split

Split
selectRange

Select the values of a range of layers, as specified by cell values in another SpatRaster
summary

summary
tapp

Apply a function to subsets of layers of a SpatRaster
terrain

terrain characteristic
options

Options
zonal

Zonal statistics
transpose

Transpose
zoom

Zoom in on a map
trim

Trim a SpatRaster
tmpFiles

Temporary files
topology

Vector topology methods
wrap

wrap (pack) a SpatRaster or SpatVector object
writeCDF

Write raster data to a NetCDF file
window

Set a window
terra-package

The terra package
vect

Create SpatVector objects
xmin

Get or set single values of an extent
xyRowColCell

Coordinates from a row, column or cell number and vice versa
voronoi

Voronoi diagram and Delauny triangles
vrt

Virtual Raster Tiles
vector_layers

List or remove layers from a vector file
dimensions

Dimensions of a SpatRaster or SpatVector and related objects