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:

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.

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

Examples

showClass("TransitionLayer")
#> Class "TransitionLayer" [package "gdistance"]
#> 
#> Slots:
#>                                                                           
#> Name:             title           extent          rotated         rotation
#> Class:        character           Extent          logical        .Rotation
#>                                                                           
#> Name:             ncols            nrows              crs              srs
#> Class:          integer          integer              CRS        character
#>                                                                           
#> Name:           history                z transitionMatrix  transitionCells
#> Class:             list             list     sparseMatrix          numeric
#>                        
#> Name:      matrixValues
#> Class:        character
#> 
#> Extends: 
#> Class "BasicRaster", directly
#> Class "TransitionData", directly, with explicit coerce
#> Class "Transition", directly

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(""))