I'm new to JTS. I'm playing a little with google maps in my spare time and after reading the docs I thought JTS could help me solve a problem:
I have a list of routes. A route is a list of coordinates and a name, so I guess it is a named LineString. I would like to create a graph out of these LineStrings, but I still would like to know to which route each segment belongs.
My inital idea was to union the LineStrings. This operation nodes the set of LineStrings and returns a geometry. I used the LineStringExtractor to get the new list of LineStrings out of the Geometry, but I could not find a way to know to which route they belong to. I tried various (naive) approaches like testing for original.covers(newLineString) or for original.contains(newLineString) but that didn't work like I expected. I also tried some variations of this approach but I came to the conclusion that there probably is a more elegant way to do this.
I browsed some more through the JTS code and the mailing list archives, but I still do not have a clue what to try next.