<div dir="ltr">The definition of a valid Simple Polygonal Coverage is presented here:<div><br><div><a href="http://lin-ear-th-inking.blogspot.com/2022/08/validating-polygonal-coverages-in-jts.html">http://lin-ear-th-inking.blogspot.com/2022/08/validating-polygonal-coverages-in-jts.html</a><br></div><div><br></div><div>It's in the JTS Javadoc here:</div><div><br></div><div><a href="https://github.com/locationtech/jts/blob/master/modules/core/src/main/java/org/locationtech/jts/coverage/CoverageValidator.java#L22">https://github.com/locationtech/jts/blob/master/modules/core/src/main/java/org/locationtech/jts/coverage/CoverageValidator.java#L22</a><br></div><div><br></div><div>The GEOS doc for GEOSCoverageIsValid is here:</div><div><br></div><div><a href="http://libgeos.org/doxygen/geos__c_8h.html#a562112e71b059c2bccd84ba05b5e0907">http://libgeos.org/doxygen/geos__c_8h.html#a562112e71b059c2bccd84ba05b5e0907</a><br></div><div><br></div><div>I'll add some more details to that doco.</div><div><br></div><div>It might be nice to have an overview of what SimplePolygonalCoverages are and the operations available for them.  I'm not sure if there's a way to have section doc in doxygen.  If anyone has ideas let me know.</div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Apr 27, 2023 at 2:16 PM Sandro Santilli <<a href="mailto:strk@kbt.io">strk@kbt.io</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Wed, Apr 26, 2023 at 12:45:41PM -0700, Paul Ramsey wrote:<br>
<br>
> I am tempted to change the contract and document that<br>
> a validity check is a precondition for getting "sensible" results on<br>
> output.<br>
<br>
Where's the contract ? I was curious to understand what would<br>
ST_CoverageUnion do for me but only found these short paragraphs:<br>
<br>
  <a href="https://github.com/libgeos/geos/blob/62c928c9f37957c62fab8db69e6c8efd26ce4085/include/geos/coverage/CoverageUnion.h#L33-L40" rel="noreferrer" target="_blank">https://github.com/libgeos/geos/blob/62c928c9f37957c62fab8db69e6c8efd26ce4085/include/geos/coverage/CoverageUnion.h#L33-L40</a><br>
  <a href="https://github.com/libgeos/geos/blob/62c928c9f37957c62fab8db69e6c8efd26ce4085/include/geos/coverage/CoverageUnion.h#L48-L53" rel="noreferrer" target="_blank">https://github.com/libgeos/geos/blob/62c928c9f37957c62fab8db69e6c8efd26ce4085/include/geos/coverage/CoverageUnion.h#L48-L53</a><br>
<br>
Those two paragraphs boils down to:<br>
<br>
  Unions a polygonal coverage in an efficient way.<br>
  Valid polygonal coverage topology allows merging polygons in a very efficient way.<br>
  Takes: the polygons in the coverage (a vector of Geometry pointers)<br>
  Returns: the union of the coverage polygons (a Geometry unique pointer)<br>
<br>
Questions I have are:<br>
<br>
  - What is a "valid polygonal coverage" ?<br>
  - Do shared edges need to contain the exact same vertices ?<br>
<br>
The answer seem to be in the PostGIS pull request to expose the<br>
functionality [1], but it would be useful to have it in the GEOS<br>
(and JTS?) side too. For easier porting of JTS fixes I also find<br>
it useful to encode the "last commit of JTS" in a comment in the<br>
top of each file.<br>
<br>
[1] <a href="https://github.com/postgis/postgis/pull/731#issue-1683980686" rel="noreferrer" target="_blank">https://github.com/postgis/postgis/pull/731#issue-1683980686</a><br>
<br>
In general GEOS functions are (not sure if documented as such) expected to take<br>
a valid input for their return to be defined. There should be very few exceptions<br>
to this, maybe only the recent MakeValid.<br>
<br>
--strk;<br>
_______________________________________________<br>
geos-devel mailing list<br>
<a href="mailto:geos-devel@lists.osgeo.org" target="_blank">geos-devel@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/geos-devel" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/geos-devel</a><br>
</blockquote></div>