<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Hi Nicolas,<br>
      <br>
      <br>
      <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">>
          But as you already have your idea of the way to implement it
          I’d be glad if you could give me guide lines so that I don’t
          diverge (much) from your idea an keep a good coherency in the
          project.<o:p></o:p></span></p>
      <br>
      I would really welcome your contribution. <br>
      <br>
      Although I've thought about it I've not yet found 'the best'
      solution. E.g. one could introduce a 'virtual node' (between the
      tower nodes) which wouldn't require any changes to the algorithms.
      But this is hard for multithreaded environments and could also
      introduce several other problems.<br>
      <br>
      Your idea about returning EdgeIterator from Location2IDIndex is
      better as we could later on also implement a lookup index where
      the direction of a car could be taken into account too.<br>
      <br>
      <br>
      <span style="color:#1F497D" lang="EN-US"><o:p></o:p></span>
      <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">>
          So as I said earlier my vision was modify the
          <a moz-do-not-send="true"
href="eclipse-javadoc:%E2%98%82=graphhopper/src%5C/main%5C/java%3Ccom.graphhopper%7BGraphHopper.java%E2%98%83GraphHopper%5Eindex%E2%98%82Location2IDIndex"><span
              style="color:#1F497D;text-decoration:none">Location2IDIndex</span></a>
          and return an edge instead of a nodeId.</span></p>
      <br>
      I've done some changes in my local branch for foot/bike support
      where the location index returns a LocationIDResult (where we
      could embed the EdgeIterator) ... probably we should move the
      discussion to the issue and I'll try to publish this branch. The
      solution is similar to this here where also the closest index (for
      wayGeometry) is returned:<br>
<a class="moz-txt-link-freetext" href="https://github.com/graphhopper/graphhopper/blob/master/core/src/main/java/com/graphhopper/storage/index/LocationIDResult.java">https://github.com/graphhopper/graphhopper/blob/master/core/src/main/java/com/graphhopper/storage/index/LocationIDResult.java</a><br>
      <br>
      <br>
      <span style="color:#1F497D" lang="EN-US">> to find the tower
        node to be rooted out of</span><br>
      <br>
      This is not as simple as you describe. At least for edges which
      are not one-way an algorithm needs to know *both* tower nodes in
      order to decide which route is better S1-E1, S1-E2, S2-E1 or S2-E2
      (S=START, E=END) ... so all algorithms will have to implement
      additionally a method like 'Path calcPath(LocationIDResult, 
      LocationIDResult)'<br>
      <br>
      <br>
      <span style="color:#1F497D" lang="EN-US"><o:p></o:p></span>
      <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">>
          The two problem of this approach I can already see, are
          <o:p></o:p></span></p>
      <span style="color:#1F497D" lang="EN-US"><span
          style="mso-list:Ignore">> 1.<span style="font:7.0pt
            "Times New Roman"">      
          </span></span></span><span style="color:#1F497D" lang="EN-US">how
        can I retrieve one single edge when I only have its ID<o:p></o:p></span><span
        style="color:#1F497D" lang="EN-US"><span style="mso-list:Ignore"><br>
        </span></span><br>
      <span style="color:#1F497D" lang="EN-US"><span
          style="mso-list:Ignore">edgeIterator =
          graph.getEdgeProps(edgeId, -1);<br>
          <br>
          <br>
          > 2.<span style="font:7.0pt "Times New Roman"">      
          </span></span></span><span style="color:#1F497D" lang="EN-US">how
        can I retrieve the two tower nodes out of an EdgeIterator</span><br>
      <br>
      edgeIterator.baseNode<br>
      edgeIterator.adjNode<br>
      <br>
      (and the pillar nodes are identically to edgeIterator.wayGeometry)<br>
      <br>
      Regards,<br>
      Peter.<br>
      <br>
      <br>
    </div>
    <blockquote
cite="mid:b0f2c1a71bdc4d3c8f4470508aac5c6a@AMXPR05MB118.eurprd05.prod.outlook.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <meta name="Generator" content="Microsoft Word 14 (filtered
        medium)">
      <style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        color:black;
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"Préformaté HTML Car";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Texte de bulles Car";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";
        color:black;
        mso-fareast-language:EN-US;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        color:black;
        mso-fareast-language:EN-US;}
span.TextedebullesCar
        {mso-style-name:"Texte de bulles Car";
        mso-style-priority:99;
        mso-style-link:"Texte de bulles";
        font-family:"Tahoma","sans-serif";}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.PrformatHTMLCar
        {mso-style-name:"Préformaté HTML Car";
        mso-style-priority:99;
        mso-style-link:"Préformaté HTML";
        font-family:"Consolas","serif";
        color:black;
        mso-fareast-language:EN-US;}
span.EmailStyle22
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:1386489502;
        mso-list-type:hybrid;
        mso-list-template-ids:-22630446 135004175 135004185 135004187 135004175 135004185 135004187 135004175 135004185 135004187;}
@list l0:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level2
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level3
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level4
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level5
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level6
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level7
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level8
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level9
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">Hi
            Peter,<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">Thanks
            for you answer.<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">We
            are willing to have this feature as ap so we could develop
            it and share it.<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">But
            as you already have your idea of the way to implement it I’d
            be glad if you could give me guide lines so that I don’t
            diverge (much) from your idea an keep a good coherency in
            the project.<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">So
            as I said earlier my vision was modify the
            <a moz-do-not-send="true"
href="eclipse-javadoc:%E2%98%82=graphhopper/src%5C/main%5C/java%3Ccom.graphhopper%7BGraphHopper.java%E2%98%83GraphHopper%5Eindex%E2%98%82Location2IDIndex"><span
                style="color:#1F497D;text-decoration:none">Location2IDIndex</span></a>
            and return an edge instead of a nodeId.<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">Then
            create instrument method to find the tower node to be rooted
            out of (the edge + gps point + boolean telling if it’s an
            origin or destination (for one way restrictions))<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">I
            would then get proper from and to tower nodeIds I can pass
            to the routing algorithm to compute the path.<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">Once
            the algorithm returns me the path, I’d use my 2 previously
            computed edges to “finish the job” and correct the
            extremities of the road.<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">The
            two problem of this approach I can already see, are
            <o:p></o:p></span></p>
        <p class="MsoListParagraph"
          style="text-indent:-18.0pt;mso-list:l0 level1 lfo1"><!--[if !supportLists]--><span
            style="color:#1F497D" lang="EN-US"><span
              style="mso-list:Ignore">1.<span style="font:7.0pt
                "Times New Roman"">      
              </span></span></span><!--[endif]--><span
            style="color:#1F497D" lang="EN-US">how can I retrieve one
            single edge when I only have its ID<o:p></o:p></span></p>
        <p class="MsoListParagraph"
          style="text-indent:-18.0pt;mso-list:l0 level1 lfo1"><!--[if !supportLists]--><span
            style="color:#1F497D" lang="EN-US"><span
              style="mso-list:Ignore">2.<span style="font:7.0pt
                "Times New Roman"">      
              </span></span></span><!--[endif]--><span
            style="color:#1F497D" lang="EN-US">how can I retrieve the
            two tower nodes out of an EdgeIterator<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">What
            do you think ?<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US">Thanks<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
        <div>
          <p class="MsoNormal"><span
              style="font-size:10.0pt;color:#1F497D;mso-fareast-language:FR-BE"
              lang="EN-US">Nicolas GILLET<o:p></o:p></span></p>
          <p class="MsoNormal"><span
              style="font-size:10.0pt;color:#1F497D;mso-fareast-language:FR-BE"
              lang="EN-US"><o:p> </o:p></span></p>
          <p class="MsoNormal"><b><span
                style="color:#1F497D;mso-fareast-language:FR-BE"
                lang="EN-US">Market-IP –</span></b><i><span
                style="color:#1F497D;mso-fareast-language:FR-BE"
                lang="EN-US">
              </span></i><i><span
                style="color:#404040;mso-fareast-language:FR-BE"
                lang="EN-US">Creating Mobile Intelligence</span></i><span
              style="color:#1F497D;mso-fareast-language:FR-BE"
              lang="EN-US"><o:p></o:p></span></p>
        </div>
        <p class="MsoNormal"><span style="color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
        <div>
          <div style="border:none;border-top:solid #B5C4DF
            1.0pt;padding:3.0pt 0cm 0cm 0cm">
            <p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext;mso-fareast-language:FR-BE"
                  lang="FR">De :</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext;mso-fareast-language:FR-BE"
                lang="FR"> Peter K [<a class="moz-txt-link-freetext" href="mailto:peathal@yahoo.de">mailto:peathal@yahoo.de</a>] <br>
                <b>Envoyé :</b> mardi 14 mai 2013 16:32<br>
                <b>À :</b> <a class="moz-txt-link-abbreviated" href="mailto:graphhopper@openstreetmap.org">graphhopper@openstreetmap.org</a><br>
                <b>Objet :</b> Re: [GraphHopper] Improve route's
                geometry<o:p></o:p></span></p>
          </div>
        </div>
        <p class="MsoNormal"><o:p> </o:p></p>
        <div>
          <p class="MsoNormal" style="margin-bottom:12.0pt">Hi Nicolas,<br>
            <br>
            this limitation will be removed with solving this issue:<br>
            <a moz-do-not-send="true"
              href="https://github.com/graphhopper/graphhopper/issues/27">https://github.com/graphhopper/graphhopper/issues/27</a><br>
            <br>
            BTW: nodes between edges in graphhopper are only stored in
            wayGeometry (see GraphStorage), not as real nodes. This was
            introduced as this speeds up querying a lot and also space
            is reduced.<br>
            <br>
            Regards,<br>
            Peter.<o:p></o:p></p>
        </div>
        <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
          <p class="MsoNormal"><span lang="EN-US">Hello,</span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US">I noticed that routes
              are computed only between the graph’s nodes, and the route
              does not go close enough to the actual GPS points.</span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US">I also noticed that
              there is a small mistake when selecting the start/end node
              when the GPS point falls on an “one way” edge.</span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US">The current behavior
              is to find the closest edge to the lon/lat coordinates and
              then find the closest node on this edge to the lon/lat.</span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US">When an edge is one
              way, you don’t have to take the closes node on the edge
              but the node that will respect the traffic flow.</span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US">Mean if your starting
              point fall on an one way edge, you’ll have to start the
              routing form the end point of this edge, no matter the
              starting point may be closer to your GPS coordinates.
              Indeed, if you go from you gps point to the start node,
              you’ll have to violate the one way restriction.</span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US">(see attachment as
              example)</span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US">In this picture we
              also see the first thing I mentioned : the geometry lacks
              of accuracy between nodes and GPS coordinates ; the blue
              line does not “stop” exactly at the two little flags
              representing my GPS coordinates. (green flag: start, red
              flag : end)</span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US">I started digging into
              the code in order to solve these two issues and I came up
              thinking that the whole API needs a bit of rework.</span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US">Right now the node
              resolution returns a node ID but I think it should rather
              return an EdgeIterator of the matched edge.</span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US">With this edge, it’s
              possible to find the appropriate start/end node depending
              on the lon/lat of the point and the fact that edge is one
              way. It’s also possible “finish” the road and compute the
              missing/exceeding parts of the road.</span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US">Am I missing something
              ?</span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US">Do you think that my
              point of view is correct ?</span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US">Thank you</span><o:p></o:p></p>
          <p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span
              style="font-size:10.0pt;color:#1F497D;mso-fareast-language:FR-BE"
              lang="EN-US">Nicolas GILLET</span><o:p></o:p></p>
          <p class="MsoNormal"><span
              style="font-size:10.0pt;color:#1F497D;mso-fareast-language:FR-BE"
              lang="EN-US"> </span><o:p></o:p></p>
          <p class="MsoNormal"><b><span
                style="color:#1F497D;mso-fareast-language:FR-BE"
                lang="EN-US">Market-IP –</span></b><i><span
                style="color:#1F497D;mso-fareast-language:FR-BE"
                lang="EN-US">
              </span></i><i><span
                style="color:#404040;mso-fareast-language:FR-BE"
                lang="EN-US">Creating Mobile Intelligence</span></i><o:p></o:p></p>
          <p class="MsoNormal"><span
              style="font-size:12.0pt;font-family:"Times New
              Roman","serif";mso-fareast-language:FR-BE"><br>
              <br>
              <br>
              <o:p></o:p></span></p>
          <pre>_______________________________________________<o:p></o:p></pre>
          <pre>GraphHopper mailing list<o:p></o:p></pre>
          <pre><a moz-do-not-send="true" href="mailto:GraphHopper@openstreetmap.org">GraphHopper@openstreetmap.org</a><o:p></o:p></pre>
          <pre><a moz-do-not-send="true" href="http://lists.openstreetmap.org/listinfo/graphhopper">http://lists.openstreetmap.org/listinfo/graphhopper</a><o:p></o:p></pre>
        </blockquote>
        <p class="MsoNormal"><span
            style="font-size:12.0pt;font-family:"Times New
            Roman","serif";mso-fareast-language:FR-BE"><br>
            <br>
            <br>
            <o:p></o:p></span></p>
        <pre>-- <o:p></o:p></pre>
        <pre>GraphHopper.com Your way is our destination!<o:p></o:p></pre>
      </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="http://lists.openstreetmap.org/listinfo/graphhopper">http://lists.openstreetmap.org/listinfo/graphhopper</a>
</pre>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
GraphHopper.com Your way is our destination!</pre>
  </body>
</html>