Learn R Programming

grainscape

Efficient Modelling of Landscape Connectivity, Habitat, and Protected Area Networks

Given a landscape resistance surface, creates grains of connectivity and minimum planar graph models that can be used to calculate effective distances for landscape connectivity at multiple scales. This is a cross-platform reimplementation and update of the grainscape package (http://grainscape.r-forge.r-project.org).

To cite grainscape in publications, see citation("grainscape").

Installation

From CRAN

install.packages("grainscape")

From GitHub

  1. Install development libraries: building packages from source requires the appropriate development libraries for your operating system.

See here for more details.

- *Windows:* install [Rtools](https://cran.r-project.org/bin/windows/Rtools/).
- *macOS:* install Xcode commandline tools from the terminal: `xcode-select --install`. 
- *Debian/Ubuntu Linux:* ensure `r-base-dev` is installed.
  1. Install from GitHub:

    # install.packages("remotes")
    library("remotes")
    install_github("achubaty/grainscape")

Reporting bugs

Contact us via the package GitHub site: https://github.com/achubaty/grainscape/issues.

Contributions

This Git repository uses the Git Flow branching model (the git flow extension is useful for this). The development branch contains the latest contributions and other code that will appear in the next release, and the main branch contains the code of the latest release, which is exactly what is currently on CRAN.

To make a contribution to the package, just send a pull request. When you send your PR, make sure development is the destination branch on the grainscape repository. Your PR should pass R CMD check --as-cran, which will also be checked by GitHub Actions when the PR is submitted.

See CONTRIBUTING.md for more details.

Code of Conduct

Please note that the grainscape project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Copy Link

Version

Install

install.packages('grainscape')

Monthly Downloads

350

Version

1.0.0

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Alex M Chubaty

Last Published

July 7th, 2026

Functions in grainscape (1.0.0)

show,goc-method

Show a grainscape object
plotResistance

Plot a resistance surface with a consistent colour scheme
theme_grainscape

A ggplot2 theme for grainscape
plotWithResistance

Show a resistance surface beside a network plot
.habConnEngine

Habitat connectivity engine
graphdf

Produce a data.frame containing the structure and associated attributes
point

Identify the polygons containing locations in grains of connectivity (GOC) tessellations
threshold

Produce a minimum planar graph (MPG) at multiple scales
patchFilter

Filter out patches smaller than a specified area
mpg-class

The mpg class
.abbrev

Abbreviate names
corridor

Visualize corridors between two points using a grains of connectivity (GOC)
corridor-class

The corridor class
$

Extract or Replace Parts of an Object
MPG

Extract a minimum planar graph (MPG) model from a landscape resistance surface
grain-class

The grain class
goc-class

The goc class
export

Export spatial data from MPG and GOC models
distance

Find the grains of connectivity network distance
GOC

Produce a grains of connectivity model at multiple scales (patch-based or lattice GOC)
ggGS

Prepare data in MPG and grain objects for use with ggplot2
grainscape-maps

Test maps included with grainscape
.gFinal

.gFinal
hce-class

The hce class
.habConnRcpp

Habitat connectivity engine (C++)
grain

Extract a grain of connectivity (GOC) tessellation at a given scale
grainscape-package

Landscape Connectivity, Habitat, and Protected Area Networks
plot,corridor,ANY-method

Plot quick visualizations of grainscape objects
grainscape-defunct

Defunct functions in grainscape