Learn R Programming

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

terra (version 1.5-34)

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

License

GPL (>= 3)

Maintainer

Last Published

June 9th, 2022

Functions in terra (1.5-34)

adjacent

Adjacent cells
NAflag

Set the NA flag
align

Align a SpatExtent
SpatRaster-class

SpatRaster class
SpatExtent-class

Class "SpatExtent"
activeCat

Active category
add

Add (in place) a SpatRaster to another SpatRaster object
all.equal

Compare two SpatRasters for equality
SpatVector-class

Class "SpatVector"
aggregate

Aggregate raster or vector data
RGB

Layers representing colors
as.spatvector

Conversion to a SpatVector, or to another SpatVector type
as.raster

Coerce to a "raster" object
animate

Animate a SpatRaster
barplot

Bar plot of a SpatRaster
click

Query by clicking on a map
as.data.frame

SpatRaster or SpatVector to data.frame
as.list

SpatRaster or SpatVector to list
Arith-methods

Arithmetic
centroids

Centroids
boxplot

Box plot of SpatRaster data
boundaries

Detect boundaries (edges)
cells

Get cell numbers
app

Apply a function to the cells of a SpatRaster
approximate

Estimate values for cell values that are NA by interpolating between layers
as.character

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

Factors to numeric
atan2

Two argument arc-tangent
c

Combine SpatRaster or SpatVector objects
cartogram

Cartogram
coerce

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

Compare geometries of SpatRasters
buffer

Create a buffer around vector geometries or raster patches
Compare-methods

Compare and logical methods
crop

Cut out a geographic subset
diff

Lagged differences
cover

Replace values with values from another object
crosstab

Cross-tabulate
tighten

tighten SpatRaster or SpatRasterDataset objects
dimensions

Dimensions of a SpatRaster or SpatVector and related objects
cellSize

Area covered by each raster cell
describe

describe
crs

Get or set a coordinate reference system
depth

depth of SpatRaster layers
direction

Direction
colors

Color table
disagg

Disaggregate raster cells or vector geometries
clamp

Clamp values
expanse

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

Find gaps between polygons
crds

Get the coordinates of SpatVector geometries or SpatRaster cells
classify

Classify (or reclassify) cell values
deprecated

Deprecated methods
costDistance

Cost distance
density

Density plot
ext

Create, get or set a SpatExtent
draw

Draw a polygon, line, extent, or points
deepcopy

Deep copy
autocorrelation

Spatial autocorrelation
gdal

GDAL version, supported file formats, and cache size
initialize

Initialize a SpatRaster with values
erase

Erase parts of a SpatVector object
impose

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

Convex hull and minimal rotated rectangle
distance

Geographic distance
focalMat

Focal weights matrix
densify

Add additional nodes to lines or polygons
contour

Contour plot
focalReg

Focal regression
fillTime

Fill time gaps in a SpatRaster
dots

Make a dot-density map
focal

Focal values
factors

Categorical rasters
fillHoles

Remove holes from polygons
focal3D

Three-dimensional focal values
pairs

Pairs plot (matrix of scatterplots)
focalCor

Focal function across two layers
focalCpp

Compute focal values with an iterating C++ function
inplace

Change values in-place
inset

Make an inset map
global

global statistics
flip

Flip or reverse a raster
patches

Detect patches (clumps) of cells
gridDistance

Distance on a grid
extend

Extend
lines

Add SpatVector data to a map
hist

Histogram
makeTiles

Make tiles
head and tail

Show the head or tail of a Spat* object
extract

Extract values from a SpatRaster
layerCor

Correlation and (weighted) covariance
ifel

ifelse for SpatRasters
linearUnits

Linear units of the coordinate reference system
Spatial interpolation

Interpolate
image

SpatRaster image method
freq

Frequency table
valid

Check or fix polygon validity
intersect

Intersection
focalValues

Get focal values
mem

Memory available and needed
quantile

Quantiles of spatial data
merge

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

Names of Spat* objects
query

Query a SpatVectorProxy object
mergeTime

merge SpatRasters by timelines to create a single timeseries
lapp

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

Get or compute the minimum and maximum cell values
geom

Get the geometry (coordinates) of a SpatVector
na.omit

na.omit for SpatVector
not.na

is not NA
plot

Make a map
plotRGB

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

Spatial selection
resample

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

rescale
rasterize

Rasterize vector data
geomtype

Geometry type of a SpatVector
makeVRT

Make a VRT header file
selectHighest

select cells with high or low values
mask

Mask values in a SpatRaster or SpatVector
serialize

serialize and saveRDS for SpatRaster and SpatVector
is.bool

Raster value types
subset

Subset of a SpatRaster
selectRange

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

modal value
subset-vector

Subset of a SpatVector
origin

Origin
mosaic

mosaic SpatRasters
predict

Spatial model predictions
topology

Vector topology methods
rasterizeGeom

Rasterize geometric properties of vector data
segregate

segregate
transpose

Transpose
rapp

Range-Apply
values

Cell values and geometry attributes
sds

Create a SpatRasterDataset
xyRowColCell

Coordinates from a row, column or cell number and vice versa
is.lonlat

Check for longitude/latitude crs
xmin

Get or set single values of an extent
match

Value matching for SpatRasters
vect

Create SpatVector objects
shade

Hill shading
rep

Replicate layers
setValues

Set the values of raster cells or of geometry attributes
relate

relate
rast

Create a SpatRaster
north

North arrow
project

Change the coordinate reference system
Math-methods

General mathematical methods
nearest

nearby geometries
trim

Trim a SpatRaster
summary

summary
svc

Create a SpatVectorCollection
read and write

Read from, or write to, file
perim

Perimeter or length
persp

Perspective plot
rectify

rectify a SpatRaster
rotate

Rotate a SpatRaster along longitude
spin

spin a SpatVector
spatSample

Take a regular sample
tapp

Apply a function to subsets of layers of a SpatRaster
symdif

Symetrical difference
split

Split
sbar

scale bar
where

Where are the cells with the min or max values?
sharedPaths

Shared paths
sapp

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

Shift
zoom

Zoom in on a map
which.lyr

Which cells are TRUE?
zonal

Zonal statistics
union

Union SpatVector or SpatExtent objects
stretch

Stretch
vector-attributes

Get or replace attribute values of a SpatVector
sprc

Create a SpatRasterCollection
wrap

wrap (pack) a SpatRaster or SpatVector object
time

time of SpatRaster layers
tmpFiles

Temporary files
vrt

Virtual Raster Tiles
writeCDF

Write raster data to a NetCDF file
replace

Replace values of a SpatRaster
weighted.mean

Weighted mean of layers
width

SpatVector geometric properties
window

Set a window
scale

Scale values
terra-package

Description of the methods in the terra package
units

units of SpatRaster or SpatRasterDataSet
unique

Unique values
options

Options
scatterplot

Scatterplot of two SpatRaster layers
simplifyGeom

simplifyGeom geometries
subst

replace cell values
terrain

terrain characteristics
text

Add labels to a map
sources

Data sources of a SpatRaster
vector_layers

List or remove layers from a vector file
summarize

Summarize
voronoi

Voronoi diagram and Delaunay triangles
writeRaster

Write raster data to a file
writeVector

Write SpatVector data to a file