mbedward wrote:
>
> I might not understand your data properly, but I think you want to do
> something more like this...
>
> private List<LineString> splitMLines(ArrayList<MultiLineString>
> mlines) {
> GeometryFactory geomFactory = new GeometryFactory();
> List<LineString> lines = new ArrayList<LineString>();
>
> for (MultiLineString mls : mlines) {
> for (int i = 0; i < mls.getNumGeometries(); i++) {
> lines.add((LineString)mls.getGeometryN(i));
> }
> }
>
> Geometry grandMls = geomFactory.buildGeometry(lines);
> Point mlsPt = geomFactory.createPoint(grandMls.getCoordinate());
> Geometry nodedLines = grandMls.union(mlsPt);
>
> lines.clear();
>
> for (int i = 0, n = nodedLines.getNumGeometries(); i < n; i++) {
> Geometry g = nodedLines.getGeometryN(i);
> if (g instanceof LineString) {
> lines.add((LineString)g);
> }
> }
>
> return lines;
> }
>
Thank you very much, I knew I was missing something fundamental. Your code
does an awesome job so far. It's very fast, too. Really great stuff I think.
If I ran into further problems, I'll get back to this topic.
Thanks again,
Christian.
--
View this message in context:
http://n2.nabble.com/Building-a-connected-graph-with-OSM-data---Splitting-LineStrings-at-their-intersections-tp3086758p3132467.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users