The documentation of the st_union
function of sf
is not clear (for me!) on one point: what are the action and result of the function when applied to an sfc
with a single feature, with the parameter by_feature=FALSE
(default)? It seems that, according to the text of the documentation, nothing should happen and that the value returned should be the same as the one-feature sfc
provided.
I ask this question because it is rather common to find proposals, advice for chaining st_union
to st_combine
, especially in the context of the use of st_difference
(see the sf
manual, at geos_binary_ops
, or ?st_intersection
):
the use of st_difference(SF1,st_union(st_combine(SF2)))
is proposed.
Two questions in order to understand:
. Because st_combine
returns a single-feature sfc
, how could st_union
have any effect on such an object?
. Is there any simple case, any example, where st_union
, with by_feature=FALSE
, applied to a single sfc
has any effect?
Extract of the documentation of st_union
: "If st_union
is called with a single argument, x, and by_feature is FALSE all geometries are unioned together and an sfg
or single-geometry sfc
object is returned. If by_feature
is TRUE each feature geometry is unioned. This can for instance be used to resolve internal boundaries after polygons were combined using st_combine
."