here is some code to weight network edges according to the length of the
edge....

EdgeWeighter weighter = new EdgeWeighter() {
                        public double 
getWeight(org.geotools.graph.structure.Edge e) {
                                
                                SimpleFeature aLineString = (SimpleFeature)
e.getObject(); 
                                Geometry geom = (Geometry) 
aLineString.getDefaultGeometry();
                                return geom.getLength();        
                                                                                
                          
}
                                                                };



DijkstraShortestPathFinder dspf = new DijkstraShortestPathFinder(
networkGraph, source, weighter );

dspf.calculate();

Hope it helps.....

--
View this message in context: 
http://osgeo-org.1803224.n2.nabble.com/DijkistraShortestPathFinder-tp6427487p6449700.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to