<div dir="ltr"><p class="MsoNormal"><span style="font-size:14px">The short answer is that you need to avoid the higher level API getPaths: </span><br style="font-size:14px"><a href="https://github.com/graphhopper/graphhopper/blob/master/docs/core/low-level-api.md" target="_blank" style="font-size:14px">https://github.com/graphhopper/graphhopper/blob/master/docs/core/low-level-api.md</a><span style="font-size:14px"> </span><br style="font-size:14px"><br style="font-size:14px"><span style="font-size:14px">and instead create your storage and algorithms on your own. </span><br style="font-size:14px"><br style="font-size:14px"><span style="font-size:14px">OR subclass the GraphHopper class to know which are car points and which ones are user defined query points. </span><br style="font-size:14px"><br style="font-size:14px"><span style="font-size:14px">Also to better identify locations in QueryGraph we could introduce a mapping to find out the virtual nodes e.g. via </span><br style="font-size:14px"><span style="font-size:14px">int /*virtualNode*/ QueryGraph.getNodeId(int lookupIndex) </span><br style="font-size:14px"><span style="font-size:14px">int /*lookupIndex*/ QueryGraph.getLookupIndex(int virtualNode) </span><br style="font-size:14px"><br style="font-size:14px"><span style="font-size:14px">Also feel free to email me directly at </span><a href="mailto:peter.karich@graphhopper.com" target="_blank" style="font-size:14px">peter.karich@graphhopper.com</a><span style="font-size:14px"> for business or private project related questions. </span><br style="font-size:14px"><br style="font-size:14px"><span style="font-size:14px">Kind Regards, </span><br style="font-size:14px"><span style="font-size:14px">Peter </span><br style="font-size:14px"><br style="font-size:14px"><span style="font-size:14px">Am 27.7.15 12:54 schrieb Wesam Herbawi: </span><br style="font-size:14px"><span style="font-size:14px">-------------------- </span><br style="font-size:14px"><span style="font-size:14px">Hi peter </span><br style="font-size:14px"><span style="font-size:14px">Very sorry for this prolonged email. It is just the brainstorming phase where I am trying to figure out how can the easiest way for the implementation look like. </span><br style="font-size:14px"><br style="font-size:14px"><span style="font-size:14px">Here is a summary of my understanding of the existing code and the way that I might follow for the implementation of my use case. I have also highlited some problems that one might face. Your opinion is highly appreciated. </span><br style="font-size:14px"><br style="font-size:14px"><span style="font-size:14px">in method protected List<Path> getPaths( GHRequest request, GHResponse rsp ) </span><br style="font-size:14px"><span style="font-size:14px">The request contains, among other things, a list of GHPoints representing the sources and destinations coordinates as given by the end user. For each of these GHPoints, a QueryResult object is obtained representing the snapping of the given GHPoints to the base graph nodes (base graph is the original street graph). This results in a list of QueryResult objects. Using the base graph and the list of QueryResult objects, a QueryGraph is created by adding virtual nodes and edges to the base graph. The routing algorithm is then fed with the QueryGraph to find the shortest path for each two consecutive points in the list of QueryResult objects (when the number of QueryResult objects>2 then this probably represents way nodes). </span><br style="font-size:14px"><br style="font-size:14px"><span style="font-size:14px">The implementation that came to my mind is just to handle the carsharing vehicles as list of GHPoints (exactly as the coordinates given by the end user when asking for a shortest path). Then use these carsharing vehicles GHPoints + the user given GHPoints for source and destination to create the QueryGraph </span><br style="font-size:14px"><span style="font-size:14px">QueryGraph queryGraph = new QueryGraph(routingGraph); </span><br style="font-size:14px"><span style="font-size:14px">queryGraph.lookup(qResults); </span><br style="font-size:14px"><br style="font-size:14px"><span style="font-size:14px">where qResults contains both the vehicles QueryResults + the user given GHPoints QueryResults. </span><br style="font-size:14px"><br style="font-size:14px"><span style="font-size:14px">Problems with this approach: </span><br style="font-size:14px"><span style="font-size:14px">1) everything is done at query time (number of vehicles GHPoints is usually large) </span><br style="font-size:14px"><span style="font-size:14px">2) Cannot differentiate between vehicles’ nodes and the nodes representing the user given GHPoints in the QueryGraph. </span><br style="font-size:14px"><span style="font-size:14px">3) The vehicles QueryResults will be considered as intermediate nodes for the routing algorithm. </span><br style="font-size:14px"><br style="font-size:14px"><span style="font-size:14px">To avoid problem number 3, I can maintain two QueryResult lists one for the vehicles QueryResults and one for those representing the user given GHPoints. However this requires playing in class GraphHopper.java which is a central one. Still I cannot tell which node in the QueryGraph is a vehicle node and which one is a node representing the user given coordinates. </span><br style="font-size:14px"><br style="font-size:14px"><span style="font-size:14px">Any hints, suggestions? </span><br></p></div>