Learn R Programming

ipdw (version 0.2-2)

pathdistGen: Generate a stack of path distance raster objects

Description

Generate a stack of path distance raster objects

Usage

pathdistGen(spdf, costras, range, yearmon = "default")

Arguments

spdf
SpatialPointsDataFrame object
costras
RasterLayer cost raster
range
numeric. Range of interpolation neighborhood
yearmon
character. String specifying the name of the spdf

Value

  • RasterStack object of path distances

Examples

Run this code
spdf<-data.frame(rnorm(2))
xy<-data.frame(x=c(4,2),y=c(8,4))
coordinates(spdf)<-xy

m<-matrix(NA,10,10)
costras<-raster(m,xmn=0,xmx=ncol(m),ymn=0,ymx=nrow(m))
costras[]<-runif(ncell(costras),min=1,max=10)
#introduce spatial gradient
for(i in 1:nrow(costras)){
costras[i,]<-costras[i,]+i
costras[,i]<-costras[,i]+i
}

rstack<-pathdistGen(spdf,costras,100)

Run the code above in your browser using DataLab