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

terra (version 1.7-3)

Spatial Data Analysis

Description

Methods for spatial data analysis with vector (points, lines, polygons) and raster (grid) data. Methods for vector data include standard operations such as intersect and buffer. Raster methods include global, local, zonal, and focal computations. 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

125,186

Version

1.7-3

License

GPL (>= 3)

Maintainer

Last Published

January 24th, 2023

Functions in terra (1.7-3)

add

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

Active category
app

Apply a function to the cells of a SpatRaster
aggregate

Aggregate raster or vector data
approximate

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

Align a SpatExtent
as.data.frame

SpatRaster or SpatVector to data.frame
colors

Color table
SpatRaster-class

SpatRaster class
Arith-methods

Arithmetic
adjacent

Adjacent cells
atan2

Two argument arc-tangent
convHull

Convex hull and minimal rotated rectangle
autocorrelation

Spatial autocorrelation
coerce

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

Factors to numeric
as.list

SpatRaster* or SpatVector to list
tighten

tighten SpatRaster or SpatRasterDataset objects
cellSize

Area covered by each raster cell
classify

Classify (or reclassify) cell values
clamp

Clamp values
NAflag

Set the NA flag
RGB

Layers representing colors
crds

Get the coordinates of SpatVector geometries or SpatRaster cells
as.character

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

Coerce to a "raster" object
clamp_ts

clamp time series data
barplot

Bar plot of a SpatRaster
elongate

elongate lines
focalPairs

Focal function across two layers
gaps

Find gaps between polygons
crop

Cut out a geographic subset
click

Query by clicking on a map
crosstab

Cross-tabulate
densify

Add additional nodes to lines or polygons
global

global statistics
density

Density plot
animate

Animate a SpatRaster
all.equal

Compare two SpatRasters for equality
Compare-methods

Compare and logical methods
combineGeoms

Combine geometries
compareGeom

Compare geometries of SpatRasters
boundaries

Detect boundaries (edges)
erase

Erase parts of a SpatVector object
deprecated

deprecated methods
concats

Concatenate categorical rasters
predict

Spatial model predictions
diff

Lagged differences
boxplot

Box plot of SpatRaster data
disagg

Disaggregate raster cells or vector geometries
depth

depth of SpatRaster layers
is.lonlat

Check for longitude/latitude crs
distance

Geographic distance
valid

Check or fix polygon or extent validity
geom

Get the geometry (coordinates) of a SpatVector
extract

Extract values from a SpatRaster
focalReg

Focal regression
buffer

Create a buffer around vector geometries or raster patches
extend

Extend
factors

Categorical rasters
geomtype

Geometry type of a SpatVector
dots

Make a dot-density map
initialize

Initialize a SpatRaster with values
dimensions

Dimensions of a SpatRaster or SpatVector and related objects
inplace

Change values in-place
sieve

Sieve filter
as.spatvector

Conversion to a SpatVector, or to another SpatVector type
direction

Direction
focal3D

Three-dimensional focal values
gridDistance

Distance on a grid
cells

Get cell numbers
focal

Focal values
layerCor

Correlation and (weighted) covariance
is.bool

Raster value types
cartogram

Cartogram
centroids

Centroids
nearest

nearby geometries
headtail

head and tail of a SpatRaster or SpatVector
image

SpatRaster image method
interpIDW

Interpolate points using a moving window
persp

Perspective plot
normalize.longitude

normalize vector data that crosses the dateline
plet

Plot with leaflet
rangeFill

Fill layers with a range
draw

Draw a polygon, line, extent, or points
rapp

Range-apply
sapp

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

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

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

Combine SpatRaster or SpatVector objects
serialize

serialize and saveRDS for SpatRaster and SpatVector
sort

Sort a SpatRaster
scatterplot

Scatterplot of two SpatRaster layers
rasterizeWin

Rasterize points with a moving window
focalMat

Focal weights matrix
contour

Contour plot
Math-methods

General mathematical methods
graticule

Create a graticule
which.lyr

Which cells are TRUE?
sources

Data sources of a SpatRaster
focalCpp

Compute focal values with an iterating C++ function
describe

describe
interpNear

Nearest neighbor interpolation
subset_double

Subset a SpatRaster or a SpatVector
mem

Memory available and needed
north

North arrow
expanse

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

Extract values from a SpatRaster, SpatVector or SpatExtent
quantile

Quantiles of spatial data
ext

Create, get or set a SpatExtent
terra-package

Description of the methods in the terra package
origin

Origin
rectify

Rectify a SpatRaster
sds

Create a SpatRasterDataset
modal

modal value
inset

Make an inset map
hist

Histogram
mosaic

mosaic SpatRasters
ifel

ifelse for SpatRasters
spatSample

Take a regular sample
linearUnits

Linear units of the coordinate reference system
rasterizeGeom

Rasterize geometric properties of vector data
lines

Add SpatVector data to a map
fillHoles

Remove holes from polygons
summarize

Summarize
focalValues

Get focal values
freq

Frequency table
costDist

Cost distance
time

time of SpatRaster layers
options

Options
extremes

Get or compute the minimum and maximum cell values
vect

Create SpatVector objects
lapp

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

Intersection
match

Value matching for SpatRasters
subst

replace cell values
vector_layers

List or remove layers from a vector file
rotate

Rotate data along longitude
cover

Replace values with values from another object
na.omit

na.omit for SpatVector
shift

Shift
not.na

is not NA
vrt

Virtual Raster Dataset
sprc

Create a SpatRasterCollection
subset_dollar

Subset a SpatRaster or a SpatVector
weighted.mean

Weighted mean of layers
mergeTime

merge SpatRasters by timelines to create a single timeseries
pairs

Pairs plot (matrix of scatterplots)
crs

Get or set a coordinate reference system
spin

spin a SpatVector
plot_extent

Plot a SpatExtent
zonal

Zonal statistics
subset

Subset a SpatRaster or a SpatVector
rasterize

Rasterize vector data
plot_graticule

Plot a graticule
roll

Rolling (moving) functions
values

Cell values and geometry attributes
zoom

Zoom in on a map
sbar

scale bar
deepcopy

Deep copy
symdif

Symmetrical difference
project

Change the coordinate reference system
patches

Detect patches (clumps) of cells
writeRaster

Write raster data to a file
rcl

Combine row, column, and layer numbers
readwrite

Read from, or write to, file
scoff

Scale (gain) and offset
replace_layers

Replace layers or variables
trim

Trim a SpatRaster
merge

Merge SpatRasters, or merge a SpatVector with a data.frame
plot

Make a map
split

Split
fillTime

Fill time gaps in a SpatRaster
relate

Spatial relationships between geometries
mask

Mask values in a SpatRaster or SpatVector
flip

Flip or reverse a raster
wrap

wrap and unwrap
perim

Perimeter or length
writeVector

Write SpatVector data to a file
tapp

Apply a function to subsets of layers of a SpatRaster
unique

Unique values
sharedPaths

Shared paths
xmin

Get or set single values of an extent
segregate

segregate
replace_values

Replace values of a SpatRaster
plotRGB

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

Compute a viewshed
resample

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

units of SpatRaster or SpatRasterDataSet
rast

Create a SpatRaster
setValues

Set the values of raster cells or of geometry attributes
gdal

GDAL version, supported file formats, and cache size
tmpFiles

Temporary files
scale

Scale values
simplifyGeom

simplifyGeom geometries
voronoi

Voronoi diagram and Delaunay triangles
stretch

Stretch
rescale

rescale
interpolation

Spatial interpolation
xyRowColCell

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

Hill shading
terrain

terrain characteristics
selectHighest

select cells with high or low values
text

Add labels to a map
where

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

Make tiles
makeVRT

Make a VRT header file
map.pal

map.pal arrow
writeCDF

Write raster data to a NetCDF file
update

Change values in a file
names

Names of Spat* objects
rep

Replicate layers
query

Query a SpatVectorProxy object
topology

Vector topology methods
replace_dollar

Replace with $<-
sel

Spatial selection
width

SpatVector geometric properties
summary

summary
svc

Create a SpatVectorCollection
transpose

Transpose
union

Union SpatVector or SpatExtent objects
window

Set a window
SpatVector-class

Class "SpatVector"
SpatExtent-class

Class "SpatExtent"