I am bringing this thread back up, as I did not get any response and I 
was hoping that at least someone is playing around with the Graph package...
Any help is welcome!
Cheers
Martin

Martin Tomko wrote:
> Dear All,
> I started playing around with the graph package, that I did not use 
> before. I am trying to read in a line shapefile and create a graph, 
> and then read in a point shapefile and calculate the shortest path 
> from a given point to another one. As the points may not lay directly 
> on the edges, I need to:
> *  add nodes to the graph based on a point feature and the nearest 
> edge in the graph (split the edge, if needed),
>
> I think I should manage to compose the graph based on a feature 
> collection as follows:
> FeatureCollection<SimpleFeatureType, SimpleFeature> fc ...
>
> LineStringGraphGenerator lsgg = new LineStringGraphGenerator();
>        FeatureGraphGenerator fgg = new FeatureGraphGenerator(lsgg);
>
>        FeatureIterator<SimpleFeature> f = fc.features();
>        while(f.hasNext()){
>            Feature ft = f.next();
>            fgg.add(ft);
>        }
>        // lgb is loaded
>        Graph g = fgg.getGraph();
>        return g;
>
>
> And use the DijkstraShortestPathFinder to find the paths. I found a 
> function *nearestColinearPoint* (from org.geotools.math.Line), but it 
> seems like I have to convert from Features to JTS geometries, then to 
> java.awt.geom.Line2D and java.awt.geom.Point2D and back to use this. 
> Is there a better way to generate a colinear point feature?
>
> Furthermore, what is the best way to add the node to an edge, 
> splitting it into two edges?
>
> Thanks heaps,
> Martin
>


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to