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)
#using a matrix object
xymat<-matrix(3,3,nrow=1,ncol=2)
costras<-costrasterGen(xymat,pols,projstr=NULL)
#plotting
plot(costras)
points(xymat)Run the code above in your browser using DataLab