I reduced precision in the geometryFactory in attempt to make the polygonizer work. Now I have problem with TopologyException with union when trying to fix self-intersecting rings.

 My code for dealing with self intersecting rings...

private static boolean addLineString(LineString lineString, Polygonizer polygonizer){
        GeometryFactory gf = lineString.getFactory();
        if(lineString instanceof LinearRing){
lineString = gf.createLineString(lineString.getCoordinateSequence());
        }
// unioning the linestring with the point makes any self intersections explicit.
        Point point = gf.createPoint(lineString.getCoordinateN(0));
        Geometry toAdd = lineString.union(point);
        Coordinate[] c = toAdd.getCoordinates();
        if (c[0].equals(c[c.length-1])) {
        //Add result to polygonizer
//          System.out.println(toAdd.toText());
          polygonizer.add(toAdd);
          return true;
        } else {
// if the ring consists of point a,b,c,a where a-b-c are essentially colinear, then union destroys the ring - discard it System.out.println("Straight line detected: " + toAdd.toText());
            return false;
        }
    }

lineString.union(point) produces topography exception:
"/found non-noded intersection between LINESTRING ( 1566269.0 5566171.0, 1566550.0 5566381.0 ) and LINESTRING ( 1566565.0 5566390.0, 1566266.0 5566169.0 ) [ (1566295.5094339622, 5566190.811320755, NaN) ]"

/These two lines are nearly parallel, and do intersect. I am working with 7 digits of precision in the input coordinates and can hardly see how it is reasonable to reduce precision further. Is there a better way to

Notice: This email and any attachments are confidential.
If received in error please destroy and immediately notify us.
Do not copy or disclose the contents.

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev
_______________________________________________
Jts-topo-suite-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user

Reply via email to