I get this exception and have no idea what do I do wrong. I've created two polygons using linear ring. Then I try to find do the intersect or not. I get this exception:
com.vividsolutions.jts.geom.TopologyException: side location conflict [ (-1.7542192568359292E-100, 1.7542192568359284E-100, 0.0) ]
Here is the stackTrace:
com.vividsolutions.jts.geom.TopologyException: side location conflict [ (-1.7542192568359292E-100, 1.7542192568359284E-100, 0.0) ]
at com.vividsolutions.jts.geomgraph.EdgeEndStar.propagateSideLabels(EdgeEndStar.java:300)
at com.vividsolutions.jts.geomgraph.EdgeEndStar.computeLabelling(EdgeEndStar.java:139)
at com.vividsolutions.jts.operation.relate.RelateComputer.labelNodeEdges(RelateComputer.java:297)
at com.vividsolutions.jts.operation.relate.RelateComputer.computeIM(RelateComputer.java:132)
at com.vividsolutions.jts.operation.relate.RelateOp.getIntersectionMatrix(RelateOp.java:130)
at com.vividsolutions.jts.operation.relate.RelateOp.relate(RelateOp.java:75)
at com.vividsolutions.jts.geom.Geometry.relate(Geometry.java:1017)
at com.vividsolutions.jts.geom.Geometry.intersects(Geometry.java:769)
Exception happens in class EdgeEndStar:
//Debug.print(rightLoc != currLoc, this);
if (rightLoc != currLoc)
throw new TopologyException("side location conflict", e.getCoordinate());
if (leftLoc == Location.NONE) {
Assert.shouldNeverReachHere("found single null side (at " + e.getCoordinate() + ")");
}
currLoc = leftLoc;
Something wrong with edge wich have coordinates:
//coordinate: (-262.9001323617947, 313.3121772356619, 0.0)
//coordinate: (-232.77552855071107, 332.43790711803985, 0.0)
Please give me an idea about my mistake. I've seen several posts in google with the same exception. Sometimes I do get this exception, sometimes not. Depends on the figure shape ofcourse :)
I called isValid() on both: linearRing and on Polygon. both objects are valid.
System.out.println("=== === ===");
LinearRing linearRing = geometryFactory.createLinearRing(coordinates.toArray(new Coordinate[coordinates.size()]));
IsValidOp isValidOp = new IsValidOp(linearRing);
System.out.println("LinearRing: closed?" + linearRing.isClosed() + " valid?" + linearRing.isValid() + " isValidOp.isValid(); " + isValidOp.isValid());
Polygon polygon =geometryFactory.createPolygon(linearRing, null);
isValidOp = new IsValidOp(polygon);
System.out.println("Polygon valid? " + polygon.isValid() +" isValidOp" + isValidOp.isValid());
return new BaseGeometry(polygon);
I have no idea what do I do wrong.