[geos-devel] Collapsed MinimalEdgeRing

Sandro Santilli strk at keybit.net
Tue Apr 19 03:34:36 EDT 2011


On Mon, Apr 18, 2011 at 10:16:57PM -0700, Martin Davis wrote:
> Sandro,
> 
> For LinearRings with only 4 points, it's easy to check if they are 
> collapsed - just check if they have only 2 distinct coordinates.  This 
> is a fast check to do.

Uhm. I checked. Neither GEOS nor JTS narrow rings (1bit of difference)
are actually collapsed. At least according to st_union(st_dumppoints()).

> For rings with more coordinates, it's harder to check if they are 
> collapsed.  But that might only occur rarely or never.
> 
> I think it's reasonable to strip collapsed holes from the result.
> 
> I also think it makes sense to change the AssertionFailure to a 
> TopologyException - at least that way there's a chance to recover from it.

Great. That's what I did on the GEOS side.
But: could you check if JTS considers GEOS' ring clockwise or
counterclockwise ? There may be a robustness difference in CGAlgorithms,
which I'd like to check.

The test could be added in the existing
jts/java/test/test/jts/junit/algorithm/IsCCWTest.java

GEOS ring (as a HEXWKB LineString):
0102000000040000000000000000000000841D588465963540F56BFB214F0341408F26B714B2971B40F66BFB214F0341408C26B714B2971B400000000000000000841D588465963540

JTS ring:
0102000000040000000000000000000000841D588465963540F56BFB214F0341408F26B714B2971B40F66BFB214F0341408E26B714B2971B400000000000000000841D588465963540

> By the way, the reason your bug398bis.xml fails in JTS TestRunner is 
> that the expected result doesn't match what JTS computes - JTS computes 
> a result having the narrow hole, whereas the test case expected result 
> doesn't have the hole.  The message you see saying "shellcount <= 1" is 
> just the doc string from the test case file!

Doh!
I was confused by the fact that GEOS XMLTester considered the original
test (the one expecting the narrow hole) successful, so expected JTS
to do the same.

Glad to find predictability again,
thanks for looking :)

--strk;

  ()   Free GIS & Flash consultant/developer
  /\   http://strk.keybit.net/services.html


More information about the geos-devel mailing list