class for defining a rectangular grid of arbitrary dimension

Objects from the Class

Objects are created by using e.g.

GridTopology(c(0,0), c(1,1), c(5,5))

see SpatialGrid

Slots

cellcentre.offset:

numeric; vector with the smallest centroid coordinates for each dimension; coordinates refer to the cell centre

cellsize:

numeric; vector with the cell size in each dimension

cells.dim:

integer; vector with number of cells in each dimension

Methods

coordinates

signature(x = "SpatialGrid"): calculates coordinates for each point on the grid

summary

signature(object = "SpatialGrid"): summarize object

coerce

signature(from = "GridTopology", to = "data.frame"): convert to data.frame with columns cellcentre.offset, cellsize and cells.dim

Author

Edzer Pebesma, edzer.pebesma@uni-muenster.de

Examples

x = GridTopology(c(0,0), c(1,1), c(5,5))
class(x)
#> [1] "GridTopology"
#> attr(,"package")
#> [1] "sp"
x
#>                   X1 X2
#> cellcentre.offset  0  0
#> cellsize           1  1
#> cells.dim          5  5
summary(x)
#> Grid topology:
#>   cellcentre.offset cellsize cells.dim
#> 1                 0        1         5
#> 2                 0        1         5
coordinates(x)
#>       s1 s2
#>  [1,]  0  4
#>  [2,]  1  4
#>  [3,]  2  4
#>  [4,]  3  4
#>  [5,]  4  4
#>  [6,]  0  3
#>  [7,]  1  3
#>  [8,]  2  3
#>  [9,]  3  3
#> [10,]  4  3
#> [11,]  0  2
#> [12,]  1  2
#> [13,]  2  2
#> [14,]  3  2
#> [15,]  4  2
#> [16,]  0  1
#> [17,]  1  1
#> [18,]  2  1
#> [19,]  3  1
#> [20,]  4  1
#> [21,]  0  0
#> [22,]  1  0
#> [23,]  2  0
#> [24,]  3  0
#> [25,]  4  0
y = SpatialGrid(grid = x)
class(y)
#> [1] "SpatialGrid"
#> attr(,"package")
#> [1] "sp"
y
#> Object of class SpatialGrid
#> Grid topology:
#>   cellcentre.offset cellsize cells.dim
#> 1                 0        1         5
#> 2                 0        1         5
#> SpatialPoints:
#>       s1 s2
#>  [1,]  0  4
#>  [2,]  1  4
#>  [3,]  2  4
#>  [4,]  3  4
#>  [5,]  4  4
#>  [6,]  0  3
#>  [7,]  1  3
#>  [8,]  2  3
#>  [9,]  3  3
#> [10,]  4  3
#> [11,]  0  2
#> [12,]  1  2
#> [13,]  2  2
#> [14,]  3  2
#> [15,]  4  2
#> [16,]  0  1
#> [17,]  1  1
#> [18,]  2  1
#> [19,]  3  1
#> [20,]  4  1
#> [21,]  0  0
#> [22,]  1  0
#> [23,]  2  0
#> [24,]  3  0
#> [25,]  4  0
#> Coordinate Reference System (CRS) arguments: NA