Skip to main content
Added link to docs
Source Link
Matt
  • 17.9k
  • 4
  • 23
  • 59

The documentationdocumentation 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?

  • 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."

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.

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."

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.

The documentation of the st_unionst_union function of sfsf is not clear (for me!) on one point: what are the action and result of the function when applied to an sfcsfc with a single feature, with the parameter by_feature=FALSE 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 sfcsfc provided.

I ask this question because it is rather common to find proposals, advicesadvice for chaining st_unionst_union to st_combinest_combine, especially in the context of the use of st_differencest_difference (see the sfsf manual, at geos_binary_opsgeos_binary_ops, or ?st_intersection?st_intersection):

the use of "st_difference(SF1,st_union(st_combine(SF2)))"st_difference(SF1,st_union(st_combine(SF2))) is proposed.

Two questions in order to understand:

. Because st_combinest_combine returns a single-feature sfcsfc, how could st_unionst_union have any effect on such an object?

. Is there any simple case, any example, where st_unionst_union, with by_feature=FALSEby_feature=FALSE, applied to a single sfcsfc has any effect?

Extract of the documentation of st_unionst_union: "If st_unionst_union is called with a single argument, x, and by_feature is FALSE all geometries are unioned together and an sfgsfg or single-geometry sfcsfc object is returned. If by_featureby_feature is TRUE each feature geometry is unioned. This can for instance be used to resolve internal boundaries after polygons were combined using st_combinest_combine."

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, advices 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."

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."

Bumped by Community user
Bumped by Community user
Bumped by Community user
Source Link

Why use st_union after st_combine with sf?

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, advices 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."