Learn R Programming

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

terra (version 1.4-22)

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.4-22

License

GPL (>= 3)

Maintainer

Last Published

November 24th, 2021

Functions in terra (1.4-22)

NAflag

Set the NA flag
align

Align a SpatExtent
SpatExtent-class

Class "SpatExtent"
aggregate

Aggregate raster or vector data
activeCat

Active category
add

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

Class "SpatVector"
animate

Animate a SpatRaster
adjacent

Adjacent cells
RGB

Declare RGB channels
SpatRaster-class

SpatRaster class
boundaries

Detect boundaries (edges)
atan2

Two argument arc-tangent
as.raster

Coerce to a "raster" object
barplot

Bar plot of a SpatRaster
as.character

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

SpatRaster or SpatVector to data.frame
as.spatvector

Conversion to a SpatVector, or to another SpatVector type
catalyze

Factors to numeric
cellSize

Area covered by each raster cell
autocorrelation

Spatial autocorrelation
app

Apply a function to the cells of a SpatRaster
boxplot

Box plot of SpatRaster data
buffer

Create a buffer around vector objects or raster patches
crs

Get or set a coordinate reference system
density

Density plot
centroids

Get centroids
cells

Get cell numbers
focalMat

Focal weights matrix
ext

Create, get or set a SpatExtent
expand

Extend
compareGeom

Compare geometries of SpatRasters
clamp

Clamp values
classify

Classify (or reclassify) cell values
focalReg

Focal regression
contour

Contour plot
inset

Make an inset map
tighten

tighten SpatRaster or SpatRasterDataset objects
linearUnits

Linear units of the coordinate reference system
Spatial interpolation

Interpolate
lines

Add SpatVector data to a map
crds

Get the coordinates of SpatVector geometries or SpatRaster cells
dimensions

Dimensions of a SpatRaster or SpatVector and related objects
diff

Lagged differences
convHull

Convex hull and minimal rotated rectangle
depth

depth of SpatRaster layers
describe

describe
c

Combine SpatRaster or SpatVector objects
factors

Categorical rasters
extract

Extract values from a SpatRaster
focalValues

Get focal values
plot

Make a map
persp

Perspective plot
perim

Perimeter or length
coerce

Coercion of a SpatRaster to other object types
geom

Get the geometry (coordinates) of a SpatVector
click

Query by clicking on a map
geomtype

Geometry type of a SpatVector
crosstab

Cross-tabulate
crop

Cut out a geographic subset
freq

Frequency table
colors

Color table
patches

Detect patches (clumps) of cells
rescale

rescale
erase

Erase parts of a SpatVector object
expanse

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

scalebar
rotate

Rotate a SpatRaster along longitude
scale

Scale values
cartogram

Cartogram
focal

Focal values
draw

Draw a polygon, line, extent, or points
focalCpp

Compute focal values with an iterating C++ function
dots

Make a dot-density map
plotRGB

Red-Green-Blue plot of a multi-layered SpatRaster
is.lonlat

Check for longitude/latitude crs
intersect

Intersection
disagg

Disaggregate raster cells or vector geometries
flip

Flip or reverse a raster
gdal

GDAL version, supported file formats, and cache size
gaps

Find gaps between polygons
fillHoles

Remove holes from polygons
copy

Deep copy
global

global statistics
distance

Geographic distance
image

SpatRaster image method
cover

Replace values with values from another object
rep

Replicate layers
initialize

Initialize a SpatRaster with values
vector-attributes

Get or replace attribute values of a SpatVector
predict

Spatial model predictions
head and tail

Show the head or tail of a Spat* object
segregate

segregate
ifel

ifelse for SpatRasters
hist

Histogram
sel

Spatial selection
simplify

Simplify geometries
nearest

nearby geometries
names

Names of Spat* objects
makeTiles

Make tiles
mask

Mask values in a SpatRaster
rasterize

Rasterize vector data
sources

Data sources of a SpatRaster
spin

spin a SpatVector
split

Split
tapp

Apply a function to subsets of layers of a SpatRaster
origin

Origin
is.valid

Check polygon validity
mem

Memory available and needed
lapp

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

Symetrical difference
transpose

Transpose
topology

Vector topology methods
wrap

wrap (pack) a SpatRaster or SpatVector object
selectHighest

select cells with high or low values
read and write

Read from, or write to, file
match

Value matching for SpatRasters
writeCDF

Write raster data to a NetCDF file
units

units of SpatRaster or SpatRasterDataSet
weighted.mean

Weighted mean of layers
which.lyr

Which cells are TRUE?
terrain

terrain characteristic
zonal

Zonal statistics
text

Add labels to a map
zoom

Zoom in on a map
unique

Unique values
math

Arithmetic, logical and general mathematical methods
extremes

Get or compute the minimum and maximum cell values
pairs

Pairs plot (matrix of scatterplots)
mosaic

mosaic SpatRasters
merge

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

Range-Apply
replace

Replace values of a SpatRaster
rast

Create a SpatRaster
resample

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

Scatterplot of two SpatRaster layers
sds

Create a SpatRasterDataset
spatSample

Take a regular sample
na.omit

na.omit for SpatVector
modal

modal value
quantile

Quantiles of spatial data
project

Change the coordinate reference system
subset-vector

Subset of a SpatVector
rectify

rectify a SpatRaster
setValues

Set the values of raster cells or of geometry attributes
shade

Hill shading
relate

relate
selectRange

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

Shift
sharedPaths

Shared paths
sapp

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

Stretch
src

Create a SpatRasterCollection
terra-package

The terra package
trim

Trim a SpatRaster
subst

replace cell values
union

Union SpatVector or SpatExtent objects
summarize

Summarize
subset

Subset of a SpatRaster
options

Options
vect

Create SpatVector objects
xmin

Get or set single values of an extent
values

Cell values and geometry attributes
svc

Create a SpatVectorCollection
voronoi

Voronoi diagram and Delauny triangles
vrt

Virtual Raster Tiles
summary

summary
xyRowColCell

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

Write raster data to a file
writeVector

Write SpatVector data to a file
tmpFiles

Temporary files
time

time of SpatRaster layers
width

SpatVector geometric properties
window

Set a window