[geos-devel] Any sneaky tricks for speeding up operations with complex geometries?

Nyall Dawson nyall.dawson at gmail.com
Wed Aug 28 15:32:20 PDT 2019

On Thu, 29 Aug 2019 at 03:42, Martin Davis <mtnclimb at gmail.com> wrote:
>> > About the union question, probably no good news there, unless your data has some very unlikely characteristics.  The GEOS Cascaded Union approach is remarkably efficient at unioning sets of overlapping polygons - which it sounds like you have.  The other alternative hack is to run buffer(0), but it is unlikely to be faster.
>> Ok, thanks for the confirmation. Is there any benefit in "batching"
>> sets of geometries to cascaded union (e.g. unioning 100 geometries in
>> sets of 10, and then doing a final union of the result)? Or best to
>> throw EVERYTHING at GEOS and let it sort it out?
> Best to let GEOS handle it.  It uses a spatial index to choose sets of polygons to union. It's unlikely you could do this better (unless there is some characteristic of the data you can take advantage of)

Perfect, thanks Martin!

> It looks like GEOSCoverageUnion is able to detect non-fully-noded inputs [1] and overlaps [2], and throws an exception in this case.

And this is ideal too, great.


> I would think holes and non-contiguous parts are fine as input.
> [1] https://github.com/libgeos/geos/pull/158/files#diff-7cd9f5f9244e77677b80591da3d99207R94
> [2] https://github.com/libgeos/geos/pull/158/files#diff-7cd9f5f9244e77677b80591da3d99207R123
> _______________________________________________
> geos-devel mailing list
> geos-devel at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/geos-devel

More information about the geos-devel mailing list