Learn R Programming

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

terra (version 1.6-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 a replacement for the 'raster' package ('terra' can do more, and it is faster and easier to use).

Copy Link

Version

Install

install.packages('terra')

Monthly Downloads

183,196

Version

1.6-17

License

GPL (>= 3)

Maintainer

Last Published

September 10th, 2022

Functions in terra (1.6-17)

aggregate

Aggregate raster or vector data
add

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

Align a SpatExtent
adjacent

Adjacent cells
app

Apply a function to the cells of a SpatRaster
approximate

Estimate values for cell values that are NA by interpolating between layers
Arith-methods

Arithmetic
SpatVector-class

Class "SpatVector"
catalyze

Factors to numeric
as.data.frame

SpatRaster or SpatVector to data.frame
activeCat

Active category
tighten

tighten SpatRaster or SpatRasterDataset objects
cellSize

Area covered by each raster cell
click

Query by clicking on a map
coerce

Coercion of a SpatRaster to a vector, matrix or array
as.character

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

Combine SpatRaster or SpatVector objects
NAflag

Set the NA flag
cartogram

Cartogram
crosstab

Cross-tabulate
RGB

Layers representing colors
crs

Get or set a coordinate reference system
colors

Color table
as.list

SpatRaster* or SpatVector to list
as.raster

Coerce to a "raster" object
as.spatvector

Conversion to a SpatVector, or to another SpatVector type
boundaries

Detect boundaries (edges)
barplot

Bar plot of a SpatRaster
cells

Get cell numbers
centroids

Centroids
combineGeoms

Combine geometries
boxplot

Box plot of SpatRaster data
compareGeom

Compare geometries of SpatRasters
concats

Concatenate categorical rasters
Compare-methods

Compare and logical methods
depth

depth of SpatRaster layers
buffer

Create a buffer around vector geometries or raster patches
diff

Lagged differences
clamp

Clamp values
direction

Direction
disagg

Disaggregate raster cells or vector geometries
distance

Geographic distance
SpatExtent-class

Class "SpatExtent"
classify

Classify (or reclassify) cell values
describe

describe
expanse

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

Get the coordinates of SpatVector geometries or SpatRaster cells
dots

Make a dot-density map
focalValues

Get focal values
dimensions

Dimensions of a SpatRaster or SpatVector and related objects
draw

Draw a polygon, line, extent, or points
SpatRaster-class

SpatRaster class
contour

Contour plot
costDistance

Cost distance
erase

Erase parts of a SpatVector object
all.equal

Compare two SpatRasters for equality
focalCor

Focal function across two layers
deepcopy

Deep copy
densify

Add additional nodes to lines or polygons
freq

Frequency table
convHull

Convex hull and minimal rotated rectangle
factors

Categorical rasters
fillHoles

Remove holes from polygons
ext

Create, get or set a SpatExtent
fillTime

Fill time gaps in a SpatRaster
animate

Animate a SpatRaster
extend

Extend
focalMat

Focal weights matrix
flip

Flip or reverse a raster
geom

Get the geometry (coordinates) of a SpatVector
atan2

Two argument arc-tangent
focalCpp

Compute focal values with an iterating C++ function
ifel

ifelse for SpatRasters
image

SpatRaster image method
is.bool

Raster value types
autocorrelation

Spatial autocorrelation
gaps

Find gaps between polygons
is.lonlat

Check for longitude/latitude crs
focalReg

Focal regression
geomtype

Geometry type of a SpatVector
cover

Replace values with values from another object
match

Value matching for SpatRasters
Spatial interpolation

Interpolate
gdal

GDAL version, supported file formats, and cache size
Math-methods

General mathematical methods
crop

Cut out a geographic subset
intersect

Intersection
na.omit

na.omit for SpatVector
mem

Memory available and needed
extract

Extract values from a SpatRaster
valid

Check or fix polygon validity
density

Density plot
names

Names of Spat* objects
origin

Origin
merge

Merge multiple SpatRaster objects or SpatExtent objects, or merge a SpatVector with a data.frame
deprecated

deprecated methods
head and tail

Show the head or tail of a Spat* object
global

global statistics
gridDistance

Distance on a grid
inplace

Change values in-place
focal

Focal values
pairs

Pairs plot (matrix of scatterplots)
focal3D

Three-dimensional focal values
vector-attributes

Get or replace attribute values of a SpatVector
lapp

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

Replace values of a SpatRaster
hist

Histogram
makeVRT

Make a VRT header file
nearest

nearby geometries
inset

Make an inset map
mask

Mask values in a SpatRaster or SpatVector
impose

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

Correlation and (weighted) covariance
linearUnits

Linear units of the coordinate reference system
initialize

Initialize a SpatRaster with values
persp

Perspective plot
lines

Add SpatVector data to a map
normalize.longitude

normalize vector data that crosses the dateline
plet

Plot with leaflet
predict

Spatial model predictions
shade

Hill shading
project

Change the coordinate reference system
read and write

Read from, or write to, file
relate

Spatial relationships between geometries
rep

Replicate layers
makeTiles

Make tiles
rectify

Rectify a SpatRaster
north

North arrow
sharedPaths

Shared paths
modal

modal value
resample

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

mosaic SpatRasters
sort

Sort a SpatRaster
plot

Make a map
sources

Data sources of a SpatRaster
mergeTime

merge SpatRasters by timelines to create a single timeseries
extremes

Get or compute the minimum and maximum cell values
not.na

is not NA
segregate

segregate
sel

Spatial selection
shift

Shift
rapp

Range-Apply
plotRGB

Red-Green-Blue plot of a multi-layered SpatRaster
which.lyr

Which cells are TRUE?
rast

Create a SpatRaster
scale

Scale values
rescale

rescale
width

SpatVector geometric properties
patches

Detect patches (clumps) of cells
scatterplot

Scatterplot of two SpatRaster layers
perim

Perimeter or length
svc

Create a SpatVectorCollection
rasterize

Rasterize vector data
rasterizeGeom

Rasterize geometric properties of vector data
zoom

Zoom in on a map
symdif

Symetrical difference
simplifyGeom

simplifyGeom geometries
quantile

Quantiles of spatial data
scoff

Scale (gain) and offset
rotate

Rotate a SpatRaster along longitude
transpose

Transpose
spatSample

Take a regular sample
query

Query a SpatVectorProxy object
serialize

serialize and saveRDS for SpatRaster and SpatVector
trim

Trim a SpatRaster
sapp

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

Set the values of raster cells or of geometry attributes
tapp

Apply a function to subsets of layers of a SpatRaster
subset

Subset a SpatRaster or a SpatVector
subst

replace cell values
sds

Create a SpatRasterDataset
sprc

Create a SpatRasterCollection
sbar

scale bar
selectHighest

select cells with high or low values
options

Options
terra-package

Description of the methods in the terra package
terrain

terrain characteristics
union

Union SpatVector or SpatExtent objects
vect

Create SpatVector objects
unique

Unique values
window

Set a window
stretch

Stretch
vector_layers

List or remove layers from a vector file
selectRange

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

Voronoi diagram and Delaunay triangles
vrt

Virtual Raster Dataset
xyRowColCell

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

Zonal statistics
wrap

wrap (pack) a SpatRaster or SpatVector object
writeVector

Write SpatVector data to a file
summarize

Summarize
spin

spin a SpatVector
xmin

Get or set single values of an extent
split

Split
text

Add labels to a map
summary

summary
tmpFiles

Temporary files
topology

Vector topology methods
weighted.mean

Weighted mean of layers
time

time of SpatRaster layers
where

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

units of SpatRaster or SpatRasterDataSet
values

Cell values and geometry attributes
writeCDF

Write raster data to a NetCDF file
writeRaster

Write raster data to a file