Learn R Programming

gdistance (version 1.6.4)

Transition-classes: Transition classes

Description

TransitionLayer and TransitionStack (or Transition*) are the core classes of the package gdistance. They are the main input into the functions to calculate distances and routes. An object of the class TransitionLayer contains two main elements:

Arguments

Slots

transitionMatrix

Object of class "sparseMatrix"

transitionCells

Object of class "integer"

matrixValues

Object of class "character"

ncols

Object of class "integer"

nrows

Object of class "integer"

crs

Object of class "CRS" from sp package

extent

Object of class "Extent"

layername

Object of class "vector"

Objects from the Class

Objects can be created by calls of the form new("Transition", nrows, ncols, xmin, xmax, ymin, ymax, projection).

Extends

Class Raster

Details

a. a transition matrix with transition values between connected cells in a raster - an object of class sparseMatrix (package Matrix); b. information on the extent, resolution and projection of the underlying raster - an object of class Raster (package raster).

All slots belong to these two elements from other package, except two additional slots: 1. slot transitionCells, which is only used internally in the package; 2. slot matrixValues indicates if the nonzero values of the transition matrix contains conductance or resistance values.

Class TransitionStack contains one or more transition matrices.

Class Transition is the union of TransitionLayer and TransitionStack.

Examples

Run this code
showClass("TransitionLayer")

tr <- new("TransitionLayer", nrows=as.integer(36), ncols=as.integer(18),
          extent=extent(c(xmin=-180,xmax=180, ymin=-90,ymax=90)),
          crs=CRS("+proj=longlat +datum=WGS84"))

tr <- new("TransitionLayer",nrows=as.integer(36),ncols=as.integer(18),
          extent=extent(c(xmin=-180, xmax=180, ymin=-90,ymax=90)),
          crs=CRS(""))

Run the code above in your browser using DataLab