Learn R Programming

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

terra (version 1.3-4)

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

License

GPL (>= 3)

Maintainer

Robert Hijmans

Last Published

June 20th, 2021

Functions in terra (1.3-4)

RGB

Declare RGB channels
adjacent

Adjacent cells
aggregate

Aggregate raster or vector data
SpatRaster-class

SpatRaster class
SpatVector-class

Class "SpatVector"
NAflag

Set the NA flag
add

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

Animate a SpatRaster
activeCat

Active category
SpatExtent-class

Class "SpatExtent"
autocorrelation

Spatial autocorrelation
atan2

Two argument arc-tangent
barplot

Bar plot of a SpatRaster
boundaries

Detect boundaries (edges)
centroids

Get centroids
as.raster

Coerce to a "raster" object
cells

Get cell numbers
catalyze

Factors to numeric
app

Apply a function to the cells of a SpatRaster
cellSize

Area covered by each raster cell
as.spatvector

Conversion to a SpatVector, or to another SpatVector type
tighten

tighten SpatRaster or SpatRasterDataset objects
colors

Color table
copy

Deep copy
crs

Get or set a coordinate reference system
density

Density plot
cover

Replace values with values from another object
crds

Get the coordinates of SpatVector geometries or SpatRaster cells
classify

Classify (or reclassify) cell values
clamp

Clamp values
convHull

Convex hull and minimal rotated rectangle
crop

Cut out a geographic subset
crosstab

Cross-tabulate
as.character

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

Align a SpatExtent
compareGeom

Compare geometries of SpatRasters
contour

Contour plot
extract

Extract values from a SpatRaster
factors

Categorical rasters
head and tail

Show the head or tail of a Spat* object
boxplot

Box plot of SpatRaster data
c

Combine SpatRaster or SpatVector objects
as.data.frame

SpatRaster or SpatVector to data.frame
ext

Create, get or set a SpatExtent
distance

Geographic distance
disaggregate

Disaggregate raster cells
cartogram

Cartogram
depth

depth of SpatRaster layers
describe

describe
hist

Histogram
buffer

Create a buffer around vector objects or raster patches
focal

Focal values
ifel

ifelse for SpatRasters
image

SpatRaster image method
flip

Flip or reverse a raster
fillHoles

Remove holes from polygons
extremes

Get or compute the minimum and maximum cell values
merge

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

Make a dot-density map
is.lonlat

Check for longitude/latitude crs
draw

Draw a polygon, line, extent, or points
expand

Extend
focalMat

Focal weights matrix
origin

Origin
rectify

rectify a SpatRaster
nearest

nearby geometries
sapp

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

Apply a function to layers of a SpatRaster, or sub-datasets of a SpatRasterDataset
read and write

Read from, or write to, file
mem

Memory available and needed
sbar

scalebar
linearUnits

Linear units of the coordinate reference system
geomtype

Geometry type of a SpatVector
math

Arithmetic, logical and general mathematical methods
click

Query by clicking on a map
global

global statistics
gdal

GDAL version and supported file formats
lines

Add SpatVector data to a map
intersect

Intersection
Spatial interpolation

Interpolate
geom

Get the geometry (coordinates) of a SpatVector
names

Names of Spat* objects
na.omit

na.omit for SpatVector
summary

summary
svc

Create a SpatVectorCollection
rotate

Rotate a SpatRaster along longitude
is.valid

Check polygon validity
match

Value matching for SpatRasters
mask

Mask values in a SpatRaster
spatSample

Take a regular sample
terra-package

The terra package
project

Change the coordinate reference system
rescale

rescale
resample

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

Spatial model predictions
dimensions

Dimensions of a SpatRaster or SpatVector and related objects
coerce

Coercion of a SpatRaster to other object types
options

Options
diff

Lagged differences
shift

Shift
sources

Data sources of a SpatRaster
makeTiles

Make tiles
replace

Replace values of a SpatRaster
rapp

Range-Apply
time

time of SpatRaster layers
vector-attributes

Get or replace attribute values of a SpatVector
pairs

Pairs plot (matrix of scatterplots)
patches

Detect patches (clumps) of cells
quantile

Quantiles of spatial data
sel

Spatial selection
summarize-generics

Summarize
subst

replace cell values
zoom

Zoom in on a map
tmpFiles

Temporary files
spin

spin a SpatVector
persp

Perspective plot
rep

Replicate layers
scale

Scale values
erase

Erase parts of a SpatVector object
relate

relate
expanse

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

Scatterplot of two SpatRaster layers
setValues

Set the values of raster cells or of geometry attributes
perim

Perimeter or length
focalValues

Get focal values
initialize

Initialize a SpatRaster with values
modal

modal value
split

Split
terrain

terrain characteristic
freq

Frequency table
mosaic

mosaic SpatRasters
inset

Make an inset map
shade

Hill shading
voronoi

Voronoi diagram and Delauny triangles
src

Create a SpatRasterCollection
selectRange

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

Unique values
units

units of SpatRaster or SpatRasterDataSet
subset

Subset of a SpatRaster
writeCDF

Write raster data to a NetCDF file
text

Add labels to a map
subset-vector

Subset of a SpatVector
trim

Trim a SpatRaster
weighted.mean

Weighted mean of layers
plot

Make a map
stretch

Stretch
vrt

Virtual Raster Tiles
which.lyr

Which cells are TRUE?
rasterize

Rasterize vector data
rast

Create a SpatRaster
plotRGB

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

segregate
symdif

Symetrical difference
sds

Create a SpatRasterDataset
zonal

Zonal statistics
xyRowColCell

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

Union SpatVector or SpatExtent objects
window

Set a window
wrap

wrap (pack) a SpatRaster or SpatVector object
tapp

Apply a function to subsets of layers of a SpatRaster
transpose

Transpose
vect

Create SpatVector objects
values

Cell values and geometry attributes
topology

sharedPaths
xmin

Get or set single values of an extent
writeVector

Write SpatVector data to a file
writeRaster

Write raster data to a file