
Last chance! 50% off unlimited learning
Sale ends in
pgeometry
objectspa_add_component()
inserts components into a spatial plateau object (i.e., pgeometry
object).
spa_add_component(pgo, components, is_valid = FALSE)
A pgeometry
object containing the component
objects.
A pgeometry
object of any type.
A component
object or a list of component
objects.
A Boolean value to check if the user wants to validate the updated spatial plateau object at the end. If is_valid = TRUE
, it calls validObject()
method.
This function implements the 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).
The formal definition of the
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
Run the code above in your browser using DataLab