Description Usage Arguments Details Value Author(s) Examples
View source: R/points2polygrid.R
Coerces SpatialPolygridDataFrame
into SpatialGridDataFrame
by copying the data to all associated grid cells. It may write the result to a geoTiff file.
1 | polygrid2grid(obj, zcol = NA, returnSGDF = TRUE, geoTiffPath)
|
obj |
|
zcol |
names or numbers of the data columns to be used |
returnSGDF |
if the generated SpatialGridDataFrame is to be returned |
geoTiffPath |
filename where to save the result as geoTiff (without suffix, '.tif' is added automatically); if missing, no geoTiff is generated |
The main reason to turn a SpatialPolygridDataFrame
into a SpatialGridDataFrame
is for plotting. It can make sense to generate a (multilayer) geoTiff instead of returning the transformed data into the workspace.
A SpatialGridDataFrame
with the same values assigned as in the SpatialPolygridDataFrame
by copying the data to all associated grid cells. If returnSGDF = FALSE
it returns TRUE
.
Kristina B. Helle, kristina.helle@uni-muenster.de
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | data(SPolygridDF)
# return SpatialGridDataFrame
SGridDF1 = polygrid2grid(SPolygridDF, zcol = "b")
# generate geoTiff
polygrid2grid(SPolygridDF, returnSGDF = FALSE,
geoTiffPath = "SPolygridDF1")
# plot SpatialGridDataFrame
spplot(SGridDF1)
# view geoTiff with functions from 'raster' and delete it
SGridDF2 = brick("SPolygridDF1.tif")
plot(SGridDF2)
rm(SGridDF2)
file.remove("SPolygridDF1.tif")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.