[geos-devel] CoverageUnion

Sandro Santilli strk at kbt.io
Thu Apr 27 14:16:05 PDT 2023


On Wed, Apr 26, 2023 at 12:45:41PM -0700, Paul Ramsey wrote:

> I am tempted to change the contract and document that
> a validity check is a precondition for getting "sensible" results on
> output.

Where's the contract ? I was curious to understand what would
ST_CoverageUnion do for me but only found these short paragraphs:

  https://github.com/libgeos/geos/blob/62c928c9f37957c62fab8db69e6c8efd26ce4085/include/geos/coverage/CoverageUnion.h#L33-L40
  https://github.com/libgeos/geos/blob/62c928c9f37957c62fab8db69e6c8efd26ce4085/include/geos/coverage/CoverageUnion.h#L48-L53

Those two paragraphs boils down to:

  Unions a polygonal coverage in an efficient way.
  Valid polygonal coverage topology allows merging polygons in a very efficient way.
  Takes: the polygons in the coverage (a vector of Geometry pointers)
  Returns: the union of the coverage polygons (a Geometry unique pointer)

Questions I have are:

  - What is a "valid polygonal coverage" ?
  - Do shared edges need to contain the exact same vertices ?

The answer seem to be in the PostGIS pull request to expose the
functionality [1], but it would be useful to have it in the GEOS
(and JTS?) side too. For easier porting of JTS fixes I also find
it useful to encode the "last commit of JTS" in a comment in the
top of each file.

[1] https://github.com/postgis/postgis/pull/731#issue-1683980686

In general GEOS functions are (not sure if documented as such) expected to take
a valid input for their return to be defined. There should be very few exceptions
to this, maybe only the recent MakeValid.

--strk;


More information about the geos-devel mailing list