polygrid2grid: Coerce SpatialPolygridDataFrame into SpatialGridDataFrame and...

Description Usage Arguments Details Value Author(s) Examples

View source: R/points2polygrid.R

Description

Coerces SpatialPolygridDataFrame into SpatialGridDataFrame by copying the data to all associated grid cells. It may write the result to a geoTiff file.

Usage

1
polygrid2grid(obj, zcol = NA, returnSGDF = TRUE, geoTiffPath)

Arguments

obj

SpatialPolygridDataFrame-class

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

Details

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.

Value

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.

Author(s)

Kristina B. Helle, kristina.helle@uni-muenster.de

Examples

 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")

KristinaHelle/sensors4plumes documentation built on May 7, 2019, 12:31 p.m.