Learn R Programming

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

terra (version 1.6-7)

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

202,413

Version

1.6-7

License

GPL (>= 3)

Maintainer

Robert Hijmans

Last Published

August 7th, 2022

Functions in terra (1.6-7)

add

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

Adjacent cells
NAflag

Set the NA flag
activeCat

Active category
aggregate

Aggregate raster or vector data
SpatRaster-class

SpatRaster class
SpatVector-class

Class "SpatVector"
all.equal

Compare two SpatRasters for equality
align

Align a SpatExtent
SpatExtent-class

Class "SpatExtent"
RGB

Layers representing colors
as.data.frame

SpatRaster or SpatVector to data.frame
as.list

SpatRaster* or SpatVector to list
c

Combine SpatRaster or SpatVector objects
as.spatvector

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

Coerce to a "raster" object
cartogram

Cartogram
autocorrelation

Spatial autocorrelation
catalyze

Factors to numeric
atan2

Two argument arc-tangent
Arith-methods

Arithmetic
animate

Animate a SpatRaster
cellSize

Area covered by each raster cell
click

Query by clicking on a map
barplot

Bar plot of a SpatRaster
as.character

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

Clamp values
classify

Classify (or reclassify) cell values
app

Apply a function to the cells of a SpatRaster
boundaries

Detect boundaries (edges)
crosstab

Cross-tabulate
crs

Get or set a coordinate reference system
centroids

Centroids
contour

Contour plot
cells

Get cell numbers
crop

Cut out a geographic subset
direction

Direction
coerce

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

Get focal values
cover

Replace values with values from another object
disagg

Disaggregate raster cells or vector geometries
diff

Lagged differences
dimensions

Dimensions of a SpatRaster or SpatVector and related objects
density

Density plot
freq

Frequency table
deprecated

deprecated methods
convHull

Convex hull and minimal rotated rectangle
boxplot

Box plot of SpatRaster data
tighten

tighten SpatRaster or SpatRasterDataset objects
buffer

Create a buffer around vector geometries or raster patches
approximate

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

Deep copy
colors

Color table
expanse

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

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

Erase parts of a SpatVector object
draw

Draw a polygon, line, extent, or points
densify

Add additional nodes to lines or polygons
flip

Flip or reverse a raster
gdal

GDAL version, supported file formats, and cache size
inplace

Change values in-place
fillTime

Fill time gaps in a SpatRaster
inset

Make an inset map
gaps

Find gaps between polygons
focal

Focal values
initialize

Initialize a SpatRaster with values
combineGeoms

Combine geometries
focalCor

Focal function across two layers
extend

Extend
ext

Create, get or set a SpatExtent
extract

Extract values from a SpatRaster
compareGeom

Compare geometries of SpatRasters
distance

Geographic distance
Compare-methods

Compare and logical methods
concats

Concatenate categorical rasters
lines

Add SpatVector data to a map
focalCpp

Compute focal values with an iterating C++ function
dots

Make a dot-density map
focal3D

Three-dimensional focal values
geom

Get the geometry (coordinates) of a SpatVector
intersect

Intersection
geomtype

Geometry type of a SpatVector
Spatial interpolation

Interpolate
crds

Get the coordinates of SpatVector geometries or SpatRaster cells
hist

Histogram
head and tail

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

Raster value types
mask

Mask values in a SpatRaster or SpatVector
makeVRT

Make a VRT header file
focalMat

Focal weights matrix
is.lonlat

Check for longitude/latitude crs
depth

depth of SpatRaster layers
costDistance

Cost distance
describe

describe
names

Names of Spat* objects
na.omit

na.omit for SpatVector
plet

Plot with leaflet
makeTiles

Make tiles
match

Value matching for SpatRasters
factors

Categorical rasters
ifel

ifelse for SpatRasters
fillHoles

Remove holes from polygons
image

SpatRaster image method
mem

Memory available and needed
layerCor

Correlation and (weighted) covariance
north

North arrow
nearest

nearby geometries
linearUnits

Linear units of the coordinate reference system
plotRGB

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

Rasterize geometric properties of vector data
plot

Make a map
rast

Create a SpatRaster
read and write

Read from, or write to, file
rescale

rescale
merge

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

Change the coordinate reference system
mosaic

mosaic SpatRasters
mergeTime

merge SpatRasters by timelines to create a single timeseries
modal

modal value
quantile

Quantiles of spatial data
sbar

scale bar
Math-methods

General mathematical methods
rasterize

Rasterize vector data
resample

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

Replace values of a SpatRaster
global

global statistics
focalReg

Focal regression
valid

Check or fix polygon validity
gridDistance

Distance on a grid
predict

Spatial model predictions
lapp

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

Rotate a SpatRaster along longitude
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
extremes

Get or compute the minimum and maximum cell values
query

Query a SpatVectorProxy object
scale

Scale values
simplifyGeom

simplifyGeom geometries
tapp

Apply a function to subsets of layers of a SpatRaster
shift

Shift
sort

Sort a SpatRaster
sources

Data sources of a SpatRaster
rapp

Range-Apply
terra-package

Description of the methods in the terra package
voronoi

Voronoi diagram and Delaunay triangles
serialize

serialize and saveRDS for SpatRaster and SpatVector
setValues

Set the values of raster cells or of geometry attributes
sprc

Create a SpatRasterCollection
vrt

Virtual Raster Dataset
text

Add labels to a map
transpose

Transpose
stretch

Stretch
trim

Trim a SpatRaster
time

time of SpatRaster layers
xyRowColCell

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

Set a window
wrap

wrap (pack) a SpatRaster or SpatVector object
origin

Origin
writeVector

Write SpatVector data to a file
not.na

is not NA
summarize

Summarize
sel

Spatial selection
summary

summary
spin

spin a SpatVector
segregate

segregate
unique

Unique values
pairs

Pairs plot (matrix of scatterplots)
svc

Create a SpatVectorCollection
union

Union SpatVector or SpatExtent objects
symdif

Symetrical difference
xmin

Get or set single values of an extent
rectify

Rectify a SpatRaster
relate

relate
patches

Detect patches (clumps) of cells
zonal

Zonal statistics
topology

Vector topology methods
tmpFiles

Temporary files
units

units of SpatRaster or SpatRasterDataSet
shade

Hill shading
scatterplot

Scatterplot of two SpatRaster layers
sds

Create a SpatRasterDataset
sharedPaths

Shared paths
zoom

Zoom in on a map
perim

Perimeter or length
values

Cell values and geometry attributes
writeCDF

Write raster data to a NetCDF file
writeRaster

Write raster data to a file
rep

Replicate layers
vector-attributes

Get or replace attribute values of a SpatVector
spatSample

Take a regular sample
persp

Perspective plot
sapp

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

replace cell values
subset

Subset a SpatRaster or a SpatVector
options

Options
split

Split
vect

Create SpatVector objects
vector_layers

List or remove layers from a vector file
which.lyr

Which cells are TRUE?
terrain

terrain characteristics
width

SpatVector geometric properties
weighted.mean

Weighted mean of layers
where

Where are the cells with the min or max values?