Learn R Programming

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

terra (version 1.5-17)

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.5-17

License

GPL (>= 3)

Maintainer

Robert Hijmans

Last Published

January 30th, 2022

Functions in terra (1.5-17)

aggregate

Aggregate raster or vector data
align

Align a SpatExtent
activeCat

Active category
approximate

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

Color table
app

Apply a function to the cells of a SpatRaster
boxplot

Box plot of SpatRaster data
buffer

Create a buffer around vector geometries or raster patches
tighten

tighten SpatRaster or SpatRasterDataset objects
SpatVector-class

Class "SpatVector"
contour

Contour plot
SpatExtent-class

Class "SpatExtent"
SpatRaster-class

SpatRaster class
as.spatvector

Conversion to a SpatVector, or to another SpatVector type
add

Add (in place) a SpatRaster to another SpatRaster object
as.raster

Coerce to a "raster" object
catalyze

Factors to numeric
NAflag

Set the NA flag
cellSize

Area covered by each raster cell
Arith-methods

Arithmetic
RGB

Layers representing colors
adjacent

Adjacent cells
as.character

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

Focal values
draw

Draw a polygon, line, extent, or points
erase

Erase parts of a SpatVector object
convHull

Convex hull and minimal rotated rectangle
focal3D

Three-dimensional focal values
centroids

Get centroids
densify

Add additional nodes to lines or polygons
cells

Get cell numbers
density

Density plot
hist

Histogram
head and tail

Show the head or tail of a Spat* object
diff

Lagged differences
makeVRT

Make a VRT header file
crs

Get or set a coordinate reference system
autocorrelation

Spatial autocorrelation
atan2

Two argument arc-tangent
as.data.frame

SpatRaster or SpatVector to data.frame
geom

Get the geometry (coordinates) of a SpatVector
names

Names of Spat* objects
na.omit

na.omit for SpatVector
dimensions

Dimensions of a SpatRaster or SpatVector and related objects
mask

Mask values in a SpatRaster or SpatVector
all.equal

Compare two SpatRasters for equality
barplot

Bar plot of a SpatRaster
compareGeom

Compare geometries of SpatRasters
boundaries

Detect boundaries (edges)
as.list

SpatRaster or SpatVector to list
segregate

segregate
sbar

scale bar
subset

Subset of a SpatRaster
subst

replace cell values
sapp

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

Compare and logical methods
sds

Create a SpatRasterDataset
svc

Create a SpatVectorCollection
animate

Animate a SpatRaster
symdif

Symetrical difference
geomtype

Geometry type of a SpatVector
crds

Get the coordinates of SpatVector geometries or SpatRaster cells
click

Query by clicking on a map
layerCor

Correlation and (weighted) covariance
coerce

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

Combine SpatRaster or SpatVector objects
distance

Geographic distance
crop

Cut out a geographic subset
crosstab

Cross-tabulate
dots

Make a dot-density map
extend

Extend
direction

Direction
deepcopy

Deep copy
linearUnits

Linear units of the coordinate reference system
cover

Replace values with values from another object
match

Value matching for SpatRasters
extract

Extract values from a SpatRaster
focalCor

Focal function across two layers
disagg

Disaggregate raster cells or vector geometries
factors

Categorical rasters
fillHoles

Remove holes from polygons
ext

Create, get or set a SpatExtent
focalMat

Focal weights matrix
expanse

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

Cartogram
classify

Classify (or reclassify) cell values
clamp

Clamp values
depth

depth of SpatRaster layers
describe

describe
focalReg

Focal regression
fillTime

Fill time gaps in a SpatRaster
project

Change the coordinate reference system
inplace

Change values in-place
freq

Frequency table
Math-methods

General mathematical methods
quantile

Quantiles of spatial data
global

global statistics
focalValues

Get focal values
vector-attributes

Get or replace attribute values of a SpatVector
replace

Replace values of a SpatRaster
inset

Make an inset map
transpose

Transpose
mosaic

mosaic SpatRasters
intersect

Intersection
modal

modal value
Spatial interpolation

Interpolate
trim

Trim a SpatRaster
selectRange

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

Set the values of raster cells or of geometry attributes
zonal

Zonal statistics
terrain

terrain characteristic
spin

spin a SpatVector
sources

Data sources of a SpatRaster
options

Options
vect

Create SpatVector objects
north

North arrow
gridDistance

Distance on a grid
nearest

nearby geometries
read and write

Read from, or write to, file
flip

Flip or reverse a raster
gdal

GDAL version, supported file formats, and cache size
focalCpp

Compute focal values with an iterating C++ function
gaps

Find gaps between polygons
is.bool

Raster value types
rectify

rectify a SpatRaster
impose

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

Rotate a SpatRaster along longitude
is.lonlat

Check for longitude/latitude crs
persp

Perspective plot
mergeTime

merge SpatRasters by timelines to create a single timeseries
extremes

Get or compute the minimum and maximum cell values
initialize

Initialize a SpatRaster with values
valid

Check or fix polygon validity
lapp

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

List or remove layers from a vector file
plot

Make a map
ifel

ifelse for SpatRasters
predict

Spatial model predictions
plotRGB

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

SpatVector geometric properties
scale

Scale values
zoom

Zoom in on a map
origin

Origin
pairs

Pairs plot (matrix of scatterplots)
scatterplot

Scatterplot of two SpatRaster layers
rasterize

Rasterize vector data
rast

Create a SpatRaster
spatSample

Take a regular sample
shade

Hill shading
sharedPaths

Shared paths
summarize

Summarize
mem

Memory available and needed
split

Split
image

SpatRaster image method
lines

Add SpatVector data to a map
makeTiles

Make tiles
merge

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

Replicate layers
sprc

Create a SpatRasterCollection
units

units of SpatRaster or SpatRasterDataSet
window

Set a window
relate

relate
vrt

Virtual Raster Tiles
values

Cell values and geometry attributes
voronoi

Voronoi diagram and Delauny triangles
sel

Spatial selection
patches

Detect patches (clumps) of cells
summary

summary
selectHighest

select cells with high or low values
shift

Shift
union

Union SpatVector or SpatExtent objects
query

Query a SpatVectorProxy object
perim

Perimeter or length
unique

Unique values
simplifyGeom

simplifyGeom geometries
weighted.mean

Weighted mean of layers
which.lyr

Which cells are TRUE?
time

time of SpatRaster layers
rapp

Range-Apply
text

Add labels to a map
resample

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

rescale
stretch

Stretch
xmin

Get or set single values of an extent
writeVector

Write SpatVector data to a file
writeRaster

Write raster data to a file
xyRowColCell

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

Temporary files
subset-vector

Subset of a SpatVector
topology

Vector topology methods
tapp

Apply a function to subsets of layers of a SpatRaster
wrap

wrap (pack) a SpatRaster or SpatVector object
terra-package

The terra package
writeCDF

Write raster data to a NetCDF file