Thanks for the heads on. I did more reading on graphing and have a better understanding now on some of the concepts.My intention is to load the graph once into memory and route from there. It has approximately 15000 features.
Before I dwell further, I've got a question. I looked through the LineStringGraphGenerator class on how the graph network is built and have some questions.
I would like to know if the graph network takes into consideration road intersections during built? I'm asking this as I'm thinking it would affect routing as the shortest path might be taking a turn into another road before the road ends rather than travesing the entire road. Correct me if I'm wrong.
Thanks
Hi jason,
Considering your Queries I think you have just begun the Work.
here is Somehting that i can Help you out with.
Do U want to Load the Graph Network at all times and Create a route for
Points A and B ?
This is the most Optimum way of Doing that cause ur Data Change would be minimum and Loading the graph in memory( provided its not so huge ) would remove the overhead of Data reading and Graph Creating Everythime for every request for a Route.
Go through the Pathgenerators class which Allow you to find a Path based on Constraints.Constrains can be Distance or Customized on Various Parameters based on an interface. I think u will get better idea of this when you look at the API's provided.
This Shoudl Solve your problem.Implementation of Routing Algorithms is also there in geo-tools like Dijkstra's et all ..making your job more simpler.
Am Providing a Sample Code for ur Understanding :
Graph g = lsg.getGraph(); // ge tthe Graph from the Data. or from ur global variable.
MEdgeWeighterImpl mwi = new MEdgeWeighterImpl(); //Cost based Implementaion that u need to refer to from the API depending on your needs ..Someitmes if Trafic data present then even that is to be Consiered ..et all..
mwi.setEdgeCostMap(hmEdgeCost);
DijkstraShortestPathFinder dspf = new DijkstraShortestPathFinder(g, srcNode, mwi);
dspf.calculate();
Path p = dspf.getPath(destNode);
if (p != null) {
return p.getEdges();
// actual Rooute Edges .
} else
{
return null;
//No Route found Case .
}
Good Luck Dude ..happy Routing .
Bye.
On Tue, 08 Nov 2005 Jase wrote :
>My current research involves using open source libraries to create an online
>vehicle routing system for taxis or any vehicles as a matter of fact. I have
>done some research and identified Geotools & Geoserver as the best libraries
>for building such a system. After going through the mailing list, it seems
>that the question I am going to ask is quite a common one afterall but there
>is a lack of solution.
>
>I have a PostGIS database of roads in LineStrings. After following the
>tutorials on graphing, I have managed to create the graph network using the
>LineStringGraphGenerator. What I did was to load the entire PostGIS database
>into the linestringgraphgenerator the and the output that I have obtained
>using getGraph() is as follows:-
>
>V = [14042, 3162, 2002, 12968 … ]
>E = [20301 (6097, 20300) … ]
>Is it right to build the entire line network first before traversing even
>though I do not know the points I would like to use?
>
>I understand I should traverse the graph but I am a bit stuck as to how I
>should proceed. Say, if I would like to route from Point A to Point B, how
>would I do that? As a matter of fact, I would like to locate the closest
>vehicle in a particular area and find the quickest route to that point. I
>see that there are many classes that are in the org.geotools.graph package
>but I'm unsure on how to proceed.
>
>I appreciate if anyone can offer an insight to this.
>
>Thanks
>
>Jason
![]()
