surfaceGrid: Create grid of 3D points covering the 'facades' and 'roofs'...

Description Usage Arguments Value Note See Also Examples

View source: R/surfaceGrid.R

Description

The function creates a grid of 3D points covering the given obstacles at specified resolution. Such a grid can later on be used to quantify the shaded / non-shaded proportion of the obstacles surface area.

Usage

1
surfaceGrid(obstacles, obstacles_height_field, res, offset = 0.01)

Arguments

obstacles

A SpatialPolygonsDataFrame object specifying the obstacles outline

obstacles_height_field

Name of attribute in obstacles with extrusion height for each feature

res

Required grid resolution, in CRS units

offset

Offset between grid points and facade (horizontal distance) or between grid points and roof (vertical distance).

Value

A 3D SpatialPointsDataFrame layer, including all attributes of the original obstacles each surface point corresponds to, followed by six new attributes:

Note

The reason for introducing an offset is to avoid ambiguity as for whether the grid points are "inside" or "outside" of the obstacle. With an offset all grid points are "outside" of the building and thus not intersecting it. offset should be given in CRS units; default is 0.01.

See Also

Function plotGrid to visualize grid.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
grid = surfaceGrid(
  obstacles = build,
  obstacles_height_field = "BLDG_HT",
  res = 2
)
plot(grid)
plot(grid, pch = 1, lwd = 0.1, col = "black", add = TRUE)

# When 'res/2' is larger then height, facade will be left unsampled
build_small = build
build_small$BLDG_HT = 1
grid = surfaceGrid(
  obstacles = build_small,
  obstacles_height_field = "BLDG_HT",
  res = 2
)
plot(grid)
plot(grid, pch = 1, lwd = 0.1, col = "black", add = TRUE)
table(grid$type)

grid = surfaceGrid(
  obstacles = build_small,
  obstacles_height_field = "BLDG_HT",
  res = 2.00001  # res/2 > h
)
plot(grid)
plot(grid, pch = 1, lwd = 0.1, col = "black", add = TRUE)
table(grid$type)

# When input already contains 'obs_id', 'type', 'seg_id', 'xy_id', 'facade_az' or 'ZZZ'
build2 = build
build2$ZZZ = 1
grid = surfaceGrid(
  obstacles = build2,
  obstacles_height_field = "BLDG_HT",
  res = 2
)

shadow documentation built on March 15, 2021, 1:07 a.m.

Related to surfaceGrid in shadow...