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