View source: R/general_operations.R
spa_add_component | R Documentation |
pgeometry
objectspa_add_component()
inserts components into a spatial plateau object (i.e., pgeometry
object).
spa_add_component(pgo, components, is_valid = FALSE)
pgo |
A |
components |
A |
is_valid |
A Boolean value to check if the user wants to validate the updated spatial plateau object at the end. If |
This function implements the \odot
operator defined by Spatial Plateau Algebra.
The goal of this function is to insert a component or a list of components into a pgeometry
object.
The crisp spatial object of the component must be compatible with the type of the plateau spatial object.
For instance, a pregion
object accepts only components containing polygons (e.g., POLYGON
or MULTIPOLYGON
).
In the case of pcomposition
object any type of component is compatible to be added.
For instance, a point component is added to the plateau point sub-object of the plateau composition object.
On the other hand, as a pcollection
object can have multiple spatial objects of the same type, this function is not applicable to it.
The insertion is based on the membership degree of the component. Thus, it preserves the properties of a spatial plateau object.
However, spa_add_component()
assumes that the geometric format of the component is valid (i.e., it does not overlap with existing components).
A pgeometry
object containing the component
objects.
The formal definition of the \odot
operator is described in:
comp1 <- create_component("MULTIPOINT(1 1, 2 2)", 0.2)
comp2 <- create_component("POINT(1 5)", 0.8)
# appending these components into an empty pgeometry object
pp <- create_empty_pgeometry("PLATEAUPOINT")
pp <- spa_add_component(pp, list(comp1, comp2))
pp
# inserting components with existing membership degrees are merged
comp3 <- create_component("MULTIPOINT(0 0, 4 4)", 0.2)
pp <- spa_add_component(pp, comp3)
pp
comp4 <- create_component("MULTIPOINT(0 1, 3 4)", 1)
pc <- create_pgeometry(list(comp4), "PLATEAUCOMPOSITION")
pc
# appending these components into pc
comp5 <- create_component("LINESTRING(-1 1, 2 2)", 0.9)
comp6 <- create_component("POLYGON((0 0, 1 4, 2 2, 0 0))", 0.4)
pc <- spa_add_component(pc, list(comp5, comp6))
pc
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.