Learn R Programming

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

terra (version 1.6-3)

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

238,089

Version

1.6-3

License

GPL (>= 3)

Maintainer

Robert Hijmans

Last Published

July 25th, 2022

Functions in terra (1.6-3)

SpatRaster-class

SpatRaster class
align

Align a SpatExtent
activeCat

Active category
aggregate

Aggregate raster or vector data
NAflag

Set the NA flag
adjacent

Adjacent cells
SpatVector-class

Class "SpatVector"
add

Add (in place) a SpatRaster to another SpatRaster object
SpatExtent-class

Class "SpatExtent"
app

Apply a function to the cells of a SpatRaster
RGB

Layers representing colors
as.raster

Coerce to a "raster" object
Arith-methods

Arithmetic
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
barplot

Bar plot of a SpatRaster
atan2

Two argument arc-tangent
boundaries

Detect boundaries (edges)
classify

Classify (or reclassify) cell values
clamp

Clamp values
as.spatvector

Conversion to a SpatVector, or to another SpatVector type
autocorrelation

Spatial autocorrelation
all.equal

Compare two SpatRasters for equality
catalyze

Factors to numeric
compareGeom

Compare geometries of SpatRasters
concats

Concatenate categorical rasters
dots

Make a dot-density map
distance

Geographic distance
density

Density plot
cover

Replace values with values from another object
crop

Cut out a geographic subset
cellSize

Area covered by each raster cell
as.data.frame

SpatRaster or SpatVector to data.frame
deprecated

deprecated methods
animate

Animate a SpatRaster
cells

Get cell numbers
c

Combine SpatRaster or SpatVector objects
as.list

SpatRaster* or SpatVector to list
cartogram

Cartogram
centroids

Centroids
focalCor

Focal function across two layers
focalCpp

Compute focal values with an iterating C++ function
click

Query by clicking on a map
geom

Get the geometry (coordinates) of a SpatVector
crosstab

Cross-tabulate
crds

Get the coordinates of SpatVector geometries or SpatRaster cells
dimensions

Dimensions of a SpatRaster or SpatVector and related objects
coerce

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

Cost distance
diff

Lagged differences
crs

Get or set a coordinate reference system
direction

Direction
gdal

GDAL version, supported file formats, and cache size
gaps

Find gaps between polygons
disagg

Disaggregate raster cells or vector geometries
geomtype

Geometry type of a SpatVector
boxplot

Box plot of SpatRaster data
tighten

tighten SpatRaster or SpatRasterDataset objects
buffer

Create a buffer around vector geometries or raster patches
extend

Extend
fillHoles

Remove holes from polygons
colors

Color table
focalMat

Focal weights matrix
factors

Categorical rasters
is.bool

Raster value types
focalReg

Focal regression
focalValues

Get focal values
freq

Frequency table
extract

Extract values from a SpatRaster
combineGeoms

Combine geometries
depth

depth of SpatRaster layers
contour

Contour plot
Compare-methods

Compare and logical methods
ifel

ifelse for SpatRasters
image

SpatRaster image method
convHull

Convex hull and minimal rotated rectangle
describe

describe
head and tail

Show the head or tail of a Spat* object
is.lonlat

Check for longitude/latitude crs
hist

Histogram
draw

Draw a polygon, line, extent, or points
deepcopy

Deep copy
densify

Add additional nodes to lines or polygons
mem

Memory available and needed
mask

Mask values in a SpatRaster or SpatVector
makeVRT

Make a VRT header file
modal

modal value
valid

Check or fix polygon validity
ext

Create, get or set a SpatExtent
lapp

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

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

Erase parts of a SpatVector object
fillTime

Fill time gaps in a SpatRaster
merge

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

North arrow
initialize

Initialize a SpatRaster with values
nearest

nearby geometries
impose

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

Flip or reverse a raster
mosaic

mosaic SpatRasters
gridDistance

Distance on a grid
project

Change the coordinate reference system
global

global statistics
lines

Add SpatVector data to a map
quantile

Quantiles of spatial data
perim

Perimeter or length
focal

Focal values
focal3D

Three-dimensional focal values
makeTiles

Make tiles
mergeTime

merge SpatRasters by timelines to create a single timeseries
rep

Replicate layers
persp

Perspective plot
vector-attributes

Get or replace attribute values of a SpatVector
inplace

Change values in-place
inset

Make an inset map
scatterplot

Scatterplot of two SpatRaster layers
layerCor

Correlation and (weighted) covariance
plotRGB

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

Get or compute the minimum and maximum cell values
rapp

Range-Apply
query

Query a SpatVectorProxy object
sds

Create a SpatRasterDataset
rasterizeGeom

Rasterize geometric properties of vector data
predict

Spatial model predictions
read and write

Read from, or write to, file
linearUnits

Linear units of the coordinate reference system
na.omit

na.omit for SpatVector
intersect

Intersection
Spatial interpolation

Interpolate
names

Names of Spat* objects
Math-methods

General mathematical methods
match

Value matching for SpatRasters
selectHighest

select cells with high or low values
selectRange

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

rescale
rotate

Rotate a SpatRaster along longitude
segregate

segregate
sel

Spatial selection
serialize

serialize and saveRDS for SpatRaster and SpatVector
pairs

Pairs plot (matrix of scatterplots)
setValues

Set the values of raster cells or of geometry attributes
patches

Detect patches (clumps) of cells
subset

Subset a SpatRaster or a SpatVector
subst

replace cell values
summarize

Summarize
summary

summary
not.na

is not NA
rasterize

Rasterize vector data
rast

Create a SpatRaster
plet

Plot with leaflet
plot

Make a map
sort

Sort a SpatRaster
origin

Origin
sources

Data sources of a SpatRaster
sbar

scale bar
scale

Scale values
spatSample

Take a regular sample
sapp

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

Temporary files
window

Set a window
topology

Vector topology methods
shade

Hill shading
vect

Create SpatVector objects
vector_layers

List or remove layers from a vector file
rectify

Rectify a SpatRaster
sharedPaths

Shared paths
relate

relate
wrap

wrap (pack) a SpatRaster or SpatVector object
sprc

Create a SpatRasterCollection
stretch

Stretch
text

Add labels to a map
terrain

terrain characteristics
options

Options
union

Union SpatVector or SpatExtent objects
time

time of SpatRaster layers
unique

Unique values
where

Where are the cells with the min or max values?
weighted.mean

Weighted mean of layers
resample

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

Create a SpatVectorCollection
replace

Replace values of a SpatRaster
symdif

Symetrical difference
zonal

Zonal statistics
xyRowColCell

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

Shift
transpose

Transpose
simplifyGeom

simplifyGeom geometries
units

units of SpatRaster or SpatRasterDataSet
trim

Trim a SpatRaster
which.lyr

Which cells are TRUE?
width

SpatVector geometric properties
split

Split
spin

spin a SpatVector
xmin

Get or set single values of an extent
values

Cell values and geometry attributes
writeVector

Write SpatVector data to a file
zoom

Zoom in on a map
voronoi

Voronoi diagram and Delaunay triangles
writeCDF

Write raster data to a NetCDF file
tapp

Apply a function to subsets of layers of a SpatRaster
terra-package

Description of the methods in the terra package
vrt

Virtual Raster Tiles
writeRaster

Write raster data to a file