Learn R Programming

ipdw (version 0.2-1)

costrasterGen: Generate a cost Raster

Description

generate a cost raster from an object of class "SpatialPolygons"

Usage

costrasterGen(xymat, pols, extent = "polys", projstr)

Arguments

xymat
Matrix of coordinates
pols
SpatialPolygons object
extent
Define extent based on extent of xymat (pnts) or pols (polys). Default is polys.
projstr
proj4 string defining the inherent projection

Value

  • RasterLayer

Examples

Run this code
Sr1<-Polygon(cbind(c(0,0,2,2,0),c(0,4,4,0,0)))
Sr2<-Polygon(cbind(c(2,2,4,4,2),c(0,2,2,0,0)))
Srs1<-Polygons(list(Sr1), "s1")
Srs2<-Polygons(list(Sr2), "s2")
pols<-SpatialPolygons(list(Srs1,Srs2), 1:2)

xymat<-matrix(3,3,nrow=1,ncol=2)
costras<-costrasterGen(xymat,pols,projstr=NULL)
plot(costras)
points(xymat)

Run the code above in your browser using DataLab