createSpatialArealObjFromPoints: Function to create objects inheriting from class 'Spatial'...

Description Usage Arguments Value Examples

View source: R/createArealGeometryObjects.R

Description

Function to create objects inheriting from class Spatial with an area-measured character out of SpatialPoints or a SpatialPointsDataFrame. The created spatial object covers the spatial extent of the input object.

Usage

1
2
createSpatialArealObjFromPoints(x, desDim = 10,
  out = "SpatialPolygons")

Arguments

x

an object of class SpatialPoints or SpatialPointsDataFrame

desDim

integer indicating the desired dimension of the return object along the larger side of the bbox of the input object x

out

the desired class of the return object

Value

an object of class SpatialPolygons (default), SpatialPixels or SpatialGrid as defined by the out argument

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## load data
## Load example toy data
load(system.file("extdata","trajaggr_TestData.RData", package = "trajaggr"), verbose = FALSE)
require(sp)
# Create SpatialPolygons covering points of a TracksCollection
points <- as(TrColl, "SpatialPointsDataFrame")
spPoly <- createSpatialArealObjFromPoints(points)
class(spPoly)
# Create SpatialPixels
spPix <- createSpatialArealObjFromPoints(points, desDim = 8, out = "SpatialPixels")
class(spPix)
spPix
# Create a SpatiaGrid
pointsB1 <- as(Track_B1, "SpatialPointsDataFrame")
spGrid_B1 <- createSpatialArealObjFromPoints(pointsB1, desDim = 9, out = "SpatialGrid")
class(spGrid_B1)
slot(spGrid_B1, "grid")

roland-h/trajaggr documentation built on Jan. 19, 2021, 1:02 p.m.