| landtoraster | R Documentation |
Function transforming an object of class sf into raster (points grid) with wd, the pixel size of the raster. landname gives the variable names for which raster points have to be computed.
landtoraster(landgis, landname, wd)
landgis |
an object of class sf |
landname |
vector of names of landscape variable for which rasters are computed. |
wd |
numeric, pixels size of raster |
a list of dataframes. The components of the list correspond to variables specifed in argument landname. Each dataframe gives the X and Y locations of pixels in raster.
O. Martin
##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
data(dataSiland)
data(landSiland)
head(dataSiland)
head(landSiland)
u=landtoraster(landSiland,c("L1","L2"),wd=20)
names(u)
du1=as.data.frame(raster::rasterToPoints(u[[1]]))
du2=as.data.frame(raster::rasterToPoints(u[[2]]))
plot(du1[,1:2],type="n")
sel1=du1[,3]==1
sel2=du2[,3]==1
points(du1[sel1,c(1,2)],pch=".",col=1)
points(du2[sel2,c(1,2)],pch=".",col=2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.