The Wayback Machine - https://web.archive.org/web/20230710181315/http://github.com/rspatial/terra
Skip to content

rspatial/terra

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

Allow fun mean with na.rm = TRUE and weights not is 0, 1, NA
86c9a07

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
April 6, 2023 16:01
x
February 11, 2023 11:07
u
June 11, 2023 12:28
man
pnt
July 4, 2023 07:43
February 10, 2023 23:18
November 8, 2020 15:21
x
December 17, 2021 11:40
m
June 19, 2023 11:54
pnt
July 4, 2023 07:43
September 15, 2018 21:20
May 14, 2023 11:23
pnt
July 4, 2023 07:43
June 26, 2023 08:33
cf
June 22, 2023 22:47
cf
June 22, 2023 22:47

terra

rcmdcheck CRAN status CRAN RStudio mirror downloads

logo by Zane Dax

terra is an R package for spatial data analysis. There are tutorials at rspatial.org/terra.

stackoverflow is the best place to ask questions if you get stuck. Make sure to include a simple reproducible example. But if you think you have found a bug, please file an issue.

terra replaces the raster package. The interfaces of terra and raster are similar, but terra is simpler, faster and can do more.

Installation

terra is available from CRAN, so you can use install.packages("terra") to get the current released version.

The easiest way to use the development version on Windows or MacOS, is to install it from the R-universe, like this:

install.packages('terra', repos='https://rspatial.r-universe.dev')

From source-code

To install from source-code, first install the Rcpp package that terra depends on:

install.packages("Rcpp")

And then continue based on the OS you are using.

Windows

On Windows, you need to first install Rtools to get a C++ compiler that R can use. You need a recent version of Rtools42 (rtools42-5355-5357).

Then, in R, install the package.

Sys.setenv("R_REMOTES_NO_ERRORS_FROM_WARNINGS" = "true")
remotes::install_github("rspatial/terra")

macOS

On macOS, you can use MacPorts or Homebrew.

With MacPorts you can do

sudo port install R-terra

With Homebrew, you need to first install GDAL:

brew install pkg-config
brew install gdal

Followed by (note the additional configuration argument needed for Homebrew)

remotes::install_github("rspatial/terra", configure.args = "--with-proj-lib=$(brew --prefix)/lib/")

To install the CRAN version from source you would do

install.packages("terra", type = "source", configure.args = "--with-proj-lib=$(brew --prefix)/lib/")

Linux

The easy way to install terra on Ubuntu is with r2u.

The harder way:

Install the system requirements GDAL (>= 2.2.3), GEOS (>= 3.4.0), PROJ (>= 4.9.3), sqlite3.

sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
sudo apt-get install libgdal-dev libgeos-dev libproj-dev 

And now, in R, install the package

remotes::install_github("rspatial/terra")

See the sf instructions for installation on other linux systems --- and for possible updates/improvements on the above instructions.