A trick to get around the line string intersections are not recognised ...

a) If the line strings are not recognised because they do not *quite* line
up. Use JTS precision to "snap" all the vertices to a grid, they may then
line up enough for you to build a grab by just comparing line end points
(which is the fastest approach). Idea: perhaps you could do your own "snap
to grid" on just the end points? If it works please share your code with us.

b) If it is not working because the intersections are not "noded" (i.e.
there is no vertex digitised where the line strings cross ...). Check out
the JTS FAQ: http://tsusiatsoftware.net/jts/jts-faq/jts-faq.html#E4 for a
few more alternatives.

Jody


Jody Garnett


On Fri, Jun 13, 2014 at 10:09 PM, Elena Pop <elena0...@gmail.com> wrote:

> Hello,
>
> I've been trying to read and generate a graph from a shape file, with some
> troubles though because linestrings intersections are not recognized so i
> had to manually process the data. The way i am doing it now is a bit
> complicated and it takes more than one minute to provide results because
> its a union of 2 geometries with plenty elements..
> Do you happen to know a faster method that could help me ?
> Here is a part of the code that unifies the geometries of the lines and
> points based on which i am creating
>
>     List<LineString> lines =  polys2lines(networkFC);
>
>     GeometryFactory geomFactory = new GeometryFactory();
>
>     Geometry grandMls = geomFactory.buildGeometry(lines);
>     Point mlsPt = geomFactory.createPoint(grandMls.getCoordinate());
>     Geometry nodedLines = grandMls.union(mlsPt);
>
>     lines.clear();
>
>     for (int k = 0, n = nodedLines.getNumGeometries(); k < n; k++) {
>         Geometry g = nodedLines.getGeometryN(k);
>         if (g instanceof LineString) {
>             lines.add((LineString)g);
>          }
>     }
>
>
> ------------------------------------------------------------------------------
> HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
> Find What Matters Most in Your Big Data with HPCC Systems
> Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
> Leverages Graph Analysis for Fast Processing & Easy Data Exploration
> http://p.sf.net/sfu/hpccsystems
> _______________________________________________
> GeoTools-GT2-Users mailing list
> GeoTools-GT2-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>
------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to