From: Michael B. <mic...@gm...> - 2009-06-19 14:08:21
|
Hello > 2) Split the linestrings in a seperate method and still build the graph with > the LineStringGraphGenerator (code taken from here: > http://n2.nabble.com/Splitting-LineStrings-at-their-intersection-td1941502.html > http://n2.nabble.com/Splitting-LineStrings-at-their-intersection-td1941502.html I'm not sure if this is relevant to your problem (I haven't used the graph code in geotools) but to split your LineStrings at intersections you could try the following JTS trick (courtesy of Martin Davis's presentation at 2007 FOSS4G conference Collection lines = ... // your line strings Geometry mls = geomFactory.buildGeometry(lines); // create a MultiLineString Point mlsPt = geomFactory.createPoint(mls.getCoordinate()); // get an arbitrary point on a line Geometry nodedLines = mls.union(pt); // union the MultiLineString with the point This has the (almost magical) effect of noding all of the line intersections. Hope this helps Michael |