<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hi Wesam,<br>
<br>
To inject car points additional to the user query you'll need a
custom getPaths method in GraphHopper (via subclassing). E.g. see
here how custom weighting is done, similarly I would propose to
try with customer QueryGraph:<br>
<a class="moz-txt-link-freetext" href="https://github.com/graphhopper/graphhopper/blob/master/docs/core/weighting.md">https://github.com/graphhopper/graphhopper/blob/master/docs/core/weighting.md</a><br>
<br>
If something is missing for this to work in the GraphHopper class
please let us know.<br>
<br>
<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>
<br>
in which range is it? 1K, 10K 100K?<br>
Still I would try with the QueryGraph first and only if speed is
degraded try a more complex solution.<br>
<br>
<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>
<br>
Either handle that in your custom GraphHopper class or see my
proposed methods in QueryGraph for the mapping.<br>
<br>
<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>
Yes, you need a custom setup but query only the points you need
not with all:<br>
qGraph = new QueryGraph(graph);<br>
qGraph.lookup(allCarAndUserPoints);<br>
<br>
loop over user points only {<br>
path = createAlgo(qGraph, ..).createPath(userPoint1,userPoint2)<br>
}<br>
<br>
Kind Regards,<br>
Peter<br>
<br>
On 28.07.2015 09:53, wesam Herbawi wrote:<br>
</div>
<blockquote
cite="mid:CALqm3gDA8=Occ=HpSMzppKq-3+NzD8g5Tt32H_1__o=98cP9Bg@mail.gmail.com"
type="cite">
<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 moz-do-not-send="true"
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">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>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
GraphHopper mailing list
<a class="moz-txt-link-abbreviated" href="mailto:GraphHopper@openstreetmap.org">GraphHopper@openstreetmap.org</a>
<a class="moz-txt-link-freetext" href="https://lists.openstreetmap.org/listinfo/graphhopper">https://lists.openstreetmap.org/listinfo/graphhopper</a>
</pre>
</blockquote>
<br>
</body>
</html>