[postgis-users] st_union

Martin Davis mtnclimb at gmail.com
Wed Mar 4 13:24:22 PST 2020


Any chance we can see some example data?

I might try making some test datasets to try and show when Cascaded Union
is more efficient than buffer(0) and vice-versa. (My hypothesis is that
this depends on how much overlap there is.  In fact, if is known that there
is NO overlap then an even faster algorithm is possible - which is in fact
going to be provided in the forthcoming snap-rounded overlay code).

And if buffer(0) is still a viable technique it would be nice to expose it
as another variant of Union, so that it's clear that it is sanctioned for
use that way (and so that unit tests etc can be provided).



On Tue, Mar 3, 2020 at 11:37 PM <paul.malm at lfv.se> wrote:

> For one script I’m buffering lines and joining those buffers, some
> overlapping.
>
> For another script I’m joining polygons that  are cutted in sub maps, no
> overlapping.
>
> So there is both variants and both of those were faster with st_buffer.
>
> /Paul
>
>
>
> *Från:* postgis-users [mailto:postgis-users-bounces at lists.osgeo.org] *För
> *Martin Davis
> *Skickat:* den 3 mars 2020 15:38
> *Till:* PostGIS Users Discussion; Martin Davis
> *Ämne:* Re: [postgis-users] st_union
>
>
>
>
>
>
>
> 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?
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-users


More information about the postgis-users mailing list