jts icon indicating copy to clipboard operation
jts copied to clipboard

org.locationtech.jts.geom.TopologyException: side location conflict.

Open LyneDefense opened this issue 4 years ago • 8 comments

I use the jts 1.16 and sometimes will failed by contains method with this bug,

failed org.locationtech.jts.geom.TopologyException: side location conflict [ (-26.908931699420773, 170.85541495764005, NaN) ] at org.locationtech.jts.geomgraph.EdgeEndStar.propagateSideLabels(EdgeEndStar.java:286) at org.locationtech.jts.geomgraph.EdgeEndStar.computeLabelling(EdgeEndStar.java:125) at org.locationtech.jts.operation.relate.RelateComputer.labelNodeEdges(RelateComputer.java:290) at org.locationtech.jts.operation.relate.RelateComputer.computeIM(RelateComputer.java:125) at org.locationtech.jts.operation.relate.RelateOp.getIntersectionMatrix(RelateOp.java:112) at org.locationtech.jts.operation.relate.RelateOp.relate(RelateOp.java:57) at org.locationtech.jts.geom.Geometry.relate(Geometry.java:1045) at org.locationtech.jts.geom.Geometry.contains(Geometry.java:889) at

I wonder if this issue is solved in 1.17?

LyneDefense avatar Nov 19 '20 06:11 LyneDefense

Yes, unfortunately spatial predicates are subject to geometric non-robustness issues in rare cases.

It's unlikely that 1.17 will fix this, since there hasn't been any work done in that area of the codebase.

It would be great if you can attach the geometries causing the problem, so that we can use them for testing in future development. I'm hoping to be able to work on a new approach for predicate evaluation that will reduce or eliminate these problems.

dr-jts avatar Nov 19 '20 15:11 dr-jts

If I make the geometry valid use makeValid method, will this problem still occur?

LyneDefense avatar Nov 20 '20 02:11 LyneDefense

Ah right, I should have asked about that. Running with invalid geometry will definitely cause that error. You should check that first.

I'm hoping that the new approach for spatial predicates will be more tolerant of invalid geometry, at least for the simpler predicates such as intersects and contains etc. Although there will still be an issue where invalid geometry may produce an incorrect result.

dr-jts avatar Nov 20 '20 03:11 dr-jts

I also have this problem. found non-noded intersection between LINESTRING ( 60.554166678844076 99.26155221464131, 54.302183522617675 108.19030949739133 ) and LINESTRING ( 56.65384691165696 104.83178611580647, 55.34320364079457 103.91406381764479 ) [ (56.65384691165696, 104.83178611580647, NaN). the two LineString are valid,but jts throws this exception

LyneDefense avatar Nov 20 '20 09:11 LyneDefense

I also have this problem. found non-noded intersection between LINESTRING ( 60.554166678844076 99.26155221464131, 54.302183522617675 108.19030949739133 ) and LINESTRING ( 56.65384691165696 104.83178611580647, 55.34320364079457 103.91406381764479 ) [ (56.65384691165696, 104.83178611580647, NaN). the two LineString are valid,but jts throws this exception

What operation? What are the inputs? Can't tell anything without those.

dr-jts avatar Nov 21 '20 01:11 dr-jts

It's production enviroment error message. I can not get the inputs now. I add some logs to catch this exception, once I get the inputs i wil post here.

LyneDefense avatar Nov 25 '20 11:11 LyneDefense

It would be great if you can attach the geometries causing the problem, so that we can use them for testing in future development. I'm hoping to be able to work on a new approach for predicate evaluation that will reduce or eliminate these problems.

Here are a few samples of geometries that cause side conflict errors that you can use for testing purposes. These were generated using JTS-1.18.2. slc.txt

opeongo avatar May 14 '22 01:05 opeongo

Actually, both of the polygons in that sample data are invalid. So that's why the spatial predicates throw errors.

dr-jts avatar May 14 '22 02:05 dr-jts