Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#830 closed enhancement (fixed)

ST_UnaryUnion

Reported by: strk Owned by: strk
Priority: medium Milestone: PostGIS 2.0.0
Component: postgis Version:
Keywords: history Cc:

Description

The function accepts any GEOS-convertible geometry and applies an unary union on it. This functionality currently requires unioning anything with the empty set as ST_Union contains a short-circuit refusing to do self-union.

The union is optimized for the polygonal part of collections (which is currently impossible to get with the ST_Union aggregate).

Change History (5)

comment:1 by strk, 14 years ago

Actually, I see that even using ST_Union(<something>, <empty>) is short-circuited, so it currently takes extraction of one point on the first geometry to compute a unary union.

comment:2 by strk, 14 years ago

r6816 contains implementation and testing. Misses docs.

Notable things for the documentation:

  • ST_UnaryUnion(<invalid_polygon>) will not give you a valid polygon, but return the input untouched
  • UnaryUnion unions the _components_ of a geometry, assuming each component is valid
  • ST_UnaryUnion(ST_Collect(the_geom)) is equivalent to ST_Union(the_geom)

comment:3 by strk, 14 years ago

Oh, about the equivalence between UnaryUnion(collect(g)) and Union(g): when the input is an invalid MultiPolygon there's no equivalence. UnaryUnion returns it dissolved while Union returns it untouched. This was one of the reason to implement this in the first place.

See also ticket #101 for an old discussion about it.

comment:4 by strk, 14 years ago

Resolution: fixed
Status: newclosed

Documented in r6830

comment:5 by strk, 14 years ago

Keywords: history added
Note: See TracTickets for help on using tickets.