[postgis-users] st_union

Martin Davis mtnclimb at gmail.com
Tue Mar 3 06:38:25 PST 2020


On Tue, Mar 3, 2020 at 2:31 AM Sandro Santilli <strk at kbt.io> wrote:

> On Tue, Mar 03, 2020 at 10:12:05AM +0000, paul.malm at lfv.se wrote:
> > There was no difference between st_union() and st_unaryunion() when
> merging all adjacent polygons to  larger polygons.
> > The st_buffer() method is 3.5 times faster.
>
> The reason why ST_Buffer is faster is because it builds the topology
> of the geometry only once, while ST_Union builds it for each pair
> of geometries taken in exam. The ST_UnaryUnion version simply chooses
> which pair of geometries to union in order for the operation to be
> as effective as possible (drop more edges).
>
> There was a reason why we decided NOT to use GEOS Buffer internally
> for UnaryUnion, probably had to do with robustness, but I forgot the
> details. Maybe Martin can help here ?
>

Unioning by buffer is sometimes faster than Unary Union (Cascaded), and
sometimes not.  It all depends on the characteristics of the geometry being
processed.  If there are a lot of overlapping geometries then Cascaded
Union is faster.

So both techniques are now available, and users can choose which works
better for their data.

Paul, what does your dataset look like?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20200303/d4318159/attachment.html>


More information about the postgis-users mailing list