Learn R Programming

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

terra (version 1.5-12)

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-12

License

GPL (>= 3)

Maintainer

Last Published

January 13th, 2022

Functions in terra (1.5-12)

aggregate

Aggregate raster or vector data
add

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

Align a SpatExtent
SpatRaster-class

SpatRaster class
SpatExtent-class

Class "SpatExtent"
SpatVector-class

Class "SpatVector"
activeCat

Active category
as.raster

Coerce to a "raster" object
adjacent

Adjacent cells
NAflag

Set the NA flag
RGB

Layers representing colors
all.equal

Compare two SpatRasters for equality
approximate

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

Apply a function to the cells of a SpatRaster
boxplot

Box plot of SpatRaster data
animate

Animate a SpatRaster
Arith-methods

Arithmetic
buffer

Create a buffer around vector geometries or raster patches
c

Combine SpatRaster or SpatVector objects
arrow

North arrow
cartogram

Cartogram
as.character

Create a text representation of (the skeleton of) an object
as.spatvector

Conversion to a SpatVector, or to another SpatVector type
tighten

tighten SpatRaster or SpatRasterDataset objects
cellSize

Area covered by each raster cell
catalyze

Factors to numeric
barplot

Bar plot of a SpatRaster
as.data.frame

SpatRaster or SpatVector to data.frame
clamp

Clamp values
classify

Classify (or reclassify) cell values
boundaries

Detect boundaries (edges)
Compare-methods

Compare and logical methods
click

Query by clicking on a map
coerce

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

Convex hull and minimal rotated rectangle
contour

Contour plot
diff

Lagged differences
autocorrelation

Spatial autocorrelation
atan2

Two argument arc-tangent
densify

Add additional nodes to lines or polygons
density

Density plot
depth

depth of SpatRaster layers
crds

Get the coordinates of SpatVector geometries or SpatRaster cells
describe

describe
fillHoles

Remove holes from polygons
factors

Categorical rasters
cells

Get cell numbers
crop

Cut out a geographic subset
dimensions

Dimensions of a SpatRaster or SpatVector and related objects
compareGeom

Compare geometries of SpatRasters
crosstab

Cross-tabulate
centroids

Get centroids
gdal

GDAL version, supported file formats, and cache size
focal

Focal values
focal3D

Three-dimensional focal values
gaps

Find gaps between polygons
geom

Get the geometry (coordinates) of a SpatVector
geomtype

Geometry type of a SpatVector
lapp

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

Correlation and (weighted) covariance
initialize

Initialize a SpatRaster with values
match

Value matching for SpatRasters
impose

Impose the geometry of a SpatRaster to those in a SpatRasterCollection.
mask

Mask values in a SpatRaster
gridDistance

Distance on a grid
draw

Draw a polygon, line, extent, or points
plotRGB

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

Color table
erase

Erase parts of a SpatVector object
cover

Replace values with values from another object
global

global statistics
direction

Direction
predict

Spatial model predictions
intersect

Intersection
expand

Extend
is.bool

Raster value types
disagg

Disaggregate raster cells or vector geometries
makeTiles

Make tiles
crs

Get or set a coordinate reference system
deepcopy

Deep copy
inset

Make an inset map
freq

Frequency table
focalValues

Get focal values
extract

Extract values from a SpatRaster
Spatial interpolation

Interpolate
expanse

Get the expanse (area) of individual polygons or for all (summed) raster cells
na.omit

na.omit for SpatVector
plot

Make a map
mosaic

mosaic SpatRasters
persp

Perspective plot
project

Change the coordinate reference system
quantile

Quantiles of spatial data
focalCor

Focal function across two layers
ext

Create, get or set a SpatExtent
focalCpp

Compute focal values with an iterating C++ function
rescale

rescale
rasterize

Rasterize vector data
rotate

Rotate a SpatRaster along longitude
read and write

Read from, or write to, file
distance

Geographic distance
simplify

Simplify geometries
sources

Data sources of a SpatRaster
replace

Replace values of a SpatRaster
sel

Spatial selection
is.lonlat

Check for longitude/latitude crs
spin

spin a SpatVector
resample

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

segregate
hist

Histogram
head and tail

Show the head or tail of a Spat* object
split

Split
mem

Memory available and needed
makeVRT

Make a VRT header file
Math-methods

General mathematical methods
flip

Flip or reverse a raster
names

Names of Spat* objects
src

Create a SpatRasterCollection
dots

Make a dot-density map
fillTime

Fill time gaps in a SpatRaster
terrain

terrain characteristic
focalMat

Focal weights matrix
focalReg

Focal regression
ifel

ifelse for SpatRasters
unique

Unique values
stretch

Stretch
text

Add labels to a map
nearest

nearby geometries
rectify

rectify a SpatRaster
terra-package

The terra package
trim

Trim a SpatRaster
units

units of SpatRaster or SpatRasterDataSet
width

SpatVector geometric properties
zonal

Zonal statistics
image

SpatRaster image method
union

Union SpatVector or SpatExtent objects
options

Options
valid

Check or fix polygon validity
lines

Add SpatVector data to a map
relate

relate
window

Set a window
linearUnits

Linear units of the coordinate reference system
zoom

Zoom in on a map
shade

Hill shading
spatSample

Take a regular sample
sapp

Apply a terra function that takes only a single layer to all layers
setValues

Set the values of raster cells or of geometry attributes
summary

summary
extremes

Get or compute the minimum and maximum cell values
merge

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

merge SpatRasters by timelines to create a single timeseries
origin

Origin
writeVector

Write SpatVector data to a file
tmpFiles

Temporary files
time

time of SpatRaster layers
values

Cell values and geometry attributes
svc

Create a SpatVectorCollection
vect

Create SpatVector objects
writeRaster

Write raster data to a file
modal

modal value
patches

Detect patches (clumps) of cells
pairs

Pairs plot (matrix of scatterplots)
sds

Create a SpatRasterDataset
shift

Shift
rapp

Range-Apply
sharedPaths

Shared paths
scatterplot

Scatterplot of two SpatRaster layers
rast

Create a SpatRaster
vector-attributes

Get or replace attribute values of a SpatVector
sbar

scale bar
rep

Replicate layers
perim

Perimeter or length
selectRange

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

select cells with high or low values
scale

Scale values
subset

Subset of a SpatRaster
subset-vector

Subset of a SpatVector
symdif

Symetrical difference
transpose

Transpose
subst

replace cell values
topology

Vector topology methods
tapp

Apply a function to subsets of layers of a SpatRaster
summarize

Summarize
voronoi

Voronoi diagram and Delauny triangles
xmin

Get or set single values of an extent
vrt

Virtual Raster Tiles
weighted.mean

Weighted mean of layers
which.lyr

Which cells are TRUE?
xyRowColCell

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

wrap (pack) a SpatRaster or SpatVector object
writeCDF

Write raster data to a NetCDF file