Learn R Programming

siland (version 1.4.6)

landtoraster: Transform an object class sf into raster points

Description

The function transforms an object of class sf into raster points with wd the pixel sizes of raster. Object landmane gives the variable names for which raster points have to be computed.

Usage

landtoraster(landgis, landname, wd, data = NULL)

Arguments

landgis

an object of class sf

landname

Variable names for which raster points have to be computed.

wd

a number that correpond to size pixels for raster

data

a dataframe with positions X and Y. If a dataset is specified, the pixels in polygons containing the points in the dataframe are deleted.

Value

a list of dataframes. The components of the list correspond to variables specifed in argument landname. Each dataframe gives the position X and Y for pixels in raster.

Examples

Run this code
# NOT RUN {
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.
# }
# NOT RUN {
data(dataSiland)
data(landSiland)
dataSiland[1:10,c("X","Y")]
landSiland$L1
landSiland$L2
u1=landtoraster(landSiland,c("L1","L2"),wd=20)
names(u1)
plot(u1[[1]][,c("X","Y")],pch=".")
u2=landtoraster(landSiland,c("L1","L2"),wd=20,data=dataSiland)
points(u2[[1]][,c("X","Y")],pch=".",col=2)
points(dataSiland[,c("X","Y")],pch=16,cex=0.6,col=3)


# }
# NOT RUN {
# }

Run the code above in your browser using DataLab