<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 Tuan,<br>
      <br>
      the speed is internally stored in just a few bits of the long
      value (edgeState.getFlags)<br>
      <br>
      And to convert this for that we divide speed through the specified
      factor and use maximum 'speedBits' for the speed. E.g. 5 bits
      => 32 values => *5 => max speed of 160<br>
      So if you want a speed factor of 1 you need like 7 to 8 bits.
      Another idea could be to have a table lookup instead of the factor
      to make it more precise and compact at the same time.<br>
      <br>
      Kind Regards,<br>
      Peter<br>
      <br>
      On 03.07.2015 09:36, Tuan Nguyen wrote:<br>
    </div>
    <blockquote
cite="mid:CAFy0W8Ytq+okG=HmtrTvcDGp65eZHtLbXYFdReM7q9bd7E_FnQ@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div>
            <div>Hi Peter,<br>
              <br>
            </div>
            Thanks for the clarification on speed unit.<br>
            <br>
          </div>
          My validation logic was to check if getSpeed() in current
          graph EXACTLY match the double value that I set before. This
          usually does not match as you said, "due to the limited
          resolution". <br>
          <br>
        </div>
        Btw, can you elaborate a bit on the use of speedBits,
        speedFactor when storing speed? I know how to update speed
        through your blog posts but I cannot understand internally how
        it works. Or if you can point me to another resource, that would
        be much appreciated.<br>
        <br>
      </div>
      <div class="gmail_extra"><br clear="all">
        <div>
          <div class="gmail_signature">
            <div dir="ltr">Kind Regards,<br>
              Tuan.</div>
          </div>
        </div>
        <br>
        <div class="gmail_quote">On 3 July 2015 at 17:21, Peter <span
            dir="ltr"><<a moz-do-not-send="true"
              href="mailto:graphhopper@gmx.de" target="_blank">graphhopper@gmx.de</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div bgcolor="#FFFFFF" text="#000000">
              <div>Hi,<br>
                <br>
                good that you solved the problem but would you elaborate
                a bit on this:<span class=""><br>
                  "They are always different as the way Graphhopper
                  processes double value."<br>
                  <br>
                </span> Do you mean that getSpeed returns two different
                values before and after flush? Or just the speed you are
                expecting vs. what getSpeed returns - then, yes this is
                expected due to limited resolution which you can tune in
                the flagencoder.<br>
                <br>
                And the speed is km/h ... We even do not support mile in
                the UI (yet)<br>
                <a moz-do-not-send="true"
                  href="https://github.com/graphhopper/graphhopper/issues/396"
                  target="_blank">https://github.com/graphhopper/graphhopper/issues/396</a><span
                  class="HOEnZb"><font color="#888888"><br>
                    <br>
                    Peter</font></span>
                <div>
                  <div class="h5"><br>
                    <br>
                    On 03.07.2015 07:53, Emux wrote:<br>
                  </div>
                </div>
              </div>
              <blockquote type="cite">
                <div>
                  <div class="h5">
                    <div>On 03/07/2015 05:12 πμ, Tuan Nguyen wrote:<br>
                    </div>
                    <blockquote type="cite">
                      <div dir="ltr">By the way, is the speed used in
                        Graphhopper km/hour or mile/hour?<br>
                      </div>
                    </blockquote>
                    <br>
                    I expect it to be units based on the SI system.<br>
                    <br>
                    <div>-- <br>
                      <font color="#000000">Emux</font><br>
                      <a moz-do-not-send="true"
                        href="http://wiki.openstreetmap.org/wiki/Cruiser"
                        target="_blank">Cruiser</a> - <a
                        moz-do-not-send="true"
href="http://wiki.openstreetmap.org/wiki/Atlas_%28navigation_application%29"
                        target="_blank">Atlas</a></div>
                  </div>
                </div>
              </blockquote>
            </div>
          </blockquote>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>