moovida / dart_jts

An effort to port some of the Java Topology Suite to dart
Other
26 stars 19 forks source link

IsValidOp fails to detect a linear ring self-intersection #25

Open badger3512 opened 8 months ago

badger3512 commented 8 months ago

The IsValidOp class fails to detect the self-intersections existing in the following LinearRing.

LINEARRING (7 8, 3 8, 1 5, 1 6, 3 3, 7 3, 9 6, 9 5, 7 8)

The following test routine illustrates the issue:

test('linearringintersection_test',(){
    final wkt = 'LINEARRING (7 8, 3 8, 1 5, 1 6, 3 3, 7 3, 9 6, 9 5, 7 8)';
    final ring = WKTReader().read(wkt);
    IsValidOp op = IsValidOp(ring!);
    expect(op.validErr != null,true);
  });

The expected result is:

Ring Self-intersection at or near point (1.3333333333333335, 5.5)

An image of the geometry is shown below.

image-4

moovida commented 5 months ago

Sorry @badger3512 , didn't forget this. Need to find time to check with the java version what is going on.