Hello, Peter!<br>Thank you very much!<br>I was try and it is ok.<br>Let me show for others people some code for example:<br><br>// somewhere in main() method (for example)<br>            CmdArgs args1 = CmdArgs.readFromConfig("Cfg/Graphhopper.cfg", "graphhopper.config");<br>            GraphHopper gh = new GraphHopperJam().forServer().init(args1);<br>            gh.setEncodingManager(new EncodingManager("CAR"));<br>            gh.importOrLoad();<br>            GHRequest request = new GHRequest(56.833703,60.687447,56.777473,60.623331);<br>            // there is our own weighting method selection<br>            request.setWeighting("fastestjam"); // <- look here<br>            GHResponse response = gh.route(request);<br>            double res = response.getDistance();<br><br>// GraphHopperJam.java<br>public class GraphHopperJam extends GraphHopper {<br>    protected Weighting createWeighting( String weighting, FlagEncoder encoder )<br>    {<br>        // ignore case<br>        weighting = weighting.toLowerCase();<br>        if ("shortest".equals(weighting))<br>            return new ShortestWeighting();<br>        if ("fastestjam".equals(weighting)) // <- look here, it is added for selectable our weighting class<br>            return new FastestJamWeighting(); // our weighting class<br>        return new FastestWeighting(encoder);<br>    }<br><br>}<br><br>// FastestJamWeighting.java<br>public class FastestJamWeighting implements Weighting {<br><br>    @Override<br>    public double getMinWeight(double distance) {<br>        return distance;<br>    }<br><br>    @Override<br>    public double calcWeight(EdgeIteratorState edgeIter) {<br>        return edgeIter.getDistance(); // It will be changed for our weight algorithm<br>    }<br><br>    @Override<br>    public double revertWeight(EdgeIteratorState iter, double weight) {<br>        return weight;<br>    }<br><br>    @Override<br>    public String toString() {<br>        return "FASTESTJAM|";<br>    }<br>}<br><br><br><font color="#666">Чтв 09 Янв 2014 16:23:52 +0600, Peter K <peathal@yahoo.de> написал:</font><br><blockquote style="padding-left:10px; margin:10px 10px 10px 0px; border-left:#aaa 2px dotted">
  
    
  
  
    <div xsscleaned="moz-cite-prefix">Hey,<br>
      <br>
      if you don't use maven you'll have to add the dependencies
      explicitely. If you use maven it will download the dependencies
      you need and include it automatically into your project. IntelliJ
      and NetBeans are good in handling maven projects.<br>
      <br>
      > but it would be very nice if we can use Graphhopper as
      library and extends<br>
      > or implements some classes/methods for our purposes (instead
      overwrite the Weighting)<br>
      <br>
      with 'overwrite' I meant extending and 'overloading' the method.
      No need to change the sources for this.<br>
      <br>
      Regards,<br>
      Peter.<br>
      <br>
      <br>
    </div>
    <blockquote cite="mid:a6a0aa638ade0b357930c39256ca9ca442efab33@mail.qip.ru" type="cite">Hello again!<br>
      Also it is hard to reuse source code...<br>
      I get 0.2 version, unpack folder
      "\graphhopper-0.2\core\src\main\java\com\graphhopper\" to my
      IntelliJ IDEA's project folder \project\src\com\graphhopper\<br>
      and I get import error in "InstructionList.java":<br>
      import gnu.trove.list.TDoubleList;<br>
      Where to get that code?<br>
      Why don't you include that sources to your project?<br>
      <br>
      <br>
      <br>
      <br>
      <font color="#666">Пнд 06 Янв 2014 18:22:46 +0600, Peter K
        <a target="_blank" xsscleaned="moz-txt-link-rfc2396E" href="/compose/?adb_to=peathal@yahoo.de"><peathal@yahoo.de></a> написал:</font><br>
      <blockquote style="padding-left:10px; margin:10px 10px 10px 0px;
        border-left:#aaa 2px dotted">
        <div xsscleaned="moz-cite-prefix">Hi,<br>
          <br>
          indeed: if you are updating the edges in real time you won't
          be able to use CH or you will have to prepare the graph again
          which is not real-time but okayish for country-sized data like
          Germany (<10min) and good for even big cities (<2min).
          Updating the already contracted graph is possible but complex
          and tedious.<br>
          <br>
          If you maintain some mapping between OSM IDs (or GPS data) and
          the GraphHopper edge IDs this "update" process is easily
          implemented (and should be very fast) if you overwrite the
          Weighting (no changes necessary to the FlagEncoder I think)
          and return your own:<br>
          <br>
          @Override<br>
          public double calcWeight( EdgeIteratorState edge ) {<br>
             return getWeightForID(edge.getEdge());<br>
          }<br>
          <br>
          <br>
          > Even when you know the Edge Id, you have to iterate over
          all Edges.<br>
          <br>
          As Nicolas pointed out there is the getEdgeProps method, but I
          think extending "Weighting" should be sufficient.<br>
          <br>
          <br>
          > how to set this bitmask because I couldn't find any
          documentation on to flags itself.<br>
          <br>
          Yes, again as Nicolas said (thanks btw :) !) there is no
          documentation but you can see the CarFlagEncoder class and its
          unit tests. Mainly the first two bits specifies the access
          (forward?, backward?) and then the speed as integer (but with
          low resolution - only 5km/h). You should increase the
          resolution if you have very precise real time data.<br>
          <br>
          Regards,<br>
          Peter.<br>
          <br>
        </div>
        <blockquote cite="mid:8769c270141c4805a6814f96ef53bb7e@AMSPR05MB296.eurprd05.prod.outlook.com" type="cite">
          <div xsscleaned="WordSection1">
            <p xsscleaned="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Hello,<o:p></o:p></span></p>
            <p xsscleaned="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
            <p xsscleaned="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D" lang="EN-US">It could work but I think that this will
                get the routing algorithm even slower.<o:p></o:p></span></p>
            <p xsscleaned="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D" lang="EN-US">Add this to the drop of contraction your
                performances would get really poor I’m afraid.<o:p></o:p></span></p>
            <p xsscleaned="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
            <p xsscleaned="MsoNormal"><span style="font-size:10.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Nicolas

                GILLET<o:p></o:p></span></p>
            <p xsscleaned="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
            <p xsscleaned="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></b></p>
            <p xsscleaned="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Market-IP

                  –</span></b><i><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"></span></i><i><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#404040">Creating

                  Mobile Intelligence</span></i><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p></o:p></span></p>
            <p xsscleaned="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Phone :

                +32 81 33 11 11 <o:p></o:p></span></p>
            <p xsscleaned="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Fax :

                +32 81 33 11 10<o:p></o:p></span></p>
            <p xsscleaned="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><a target="_blank" moz-do-not-send="true" href="http://www.market-ip.com/">www.market-ip.com</a>
                – <a target="_blank" moz-do-not-send="true" href="http://www.telefleet.com/">www.telefleet.com</a>
                – <a target="_blank" moz-do-not-send="true" href="http://www.geoplanning.net/">
                  www.geoplanning.net</a> – <a target="_blank" moz-do-not-send="true" href="http://www.drivexpert.net/">www.drivexpert.net</a>
                <o:p></o:p></span></p>
            <p xsscleaned="MsoNormal"><a target="_blank" moz-do-not-send="true" href="http://www.linkedin.com/groups/MarketIP-4289716?gid=4289716&trk=hb_side_g"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;text-decoration:none"><img moz-do-not-send="true" xsscleaned="Image_x0020_1" alt="Description :
                    cid:image003.png@01CD5521.849F3340" border="0" height="25" width="30"></span></a><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p></o:p></span></p>
            <p xsscleaned="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
            <p xsscleaned="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"" lang="FR">De :</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"" lang="FR"> <a moz-do-not-send="true" target="_blank" xsscleaned="moz-txt-link-abbreviated" href="/compose/?adb_to=lanmaster@hotmail.ru">lanmaster@hotmail.ru</a>
                [<a moz-do-not-send="true" target="_blank" xsscleaned="moz-txt-link-freetext" href="/compose/?adb_to=lanmaster@hotmail.ru">mailto:lanmaster@hotmail.ru</a>]
                <br>
                <b>Envoyé :</b> lundi 6 janvier 2014 12:17<br>
                <b>À :</b> Nicolas Gillet<br>
                <b>Cc :</b> GraphHopper Java routing engine; Jrgen
                Zornig<br>
                <b>Objet :</b> Re: Re: [GraphHopper] How to ­­consider
                traffic jam whe­n­ route on road network<o:p></o:p></span></p>
            <p xsscleaned="MsoNormal"><o:p> </o:p></p>
            <p xsscleaned="MsoNormal">Hello, Nicolas,<br>
              <br>
              Why do I need to change any edge's weight? <br>
              <span xsscleaned="hps"><span lang="EN">My thought is about
                  make no change </span></span>in the graph data, but
              parallel calculate my own weights and use that in
              algorithm-place, where gets original Graph's weights.<br>
              May be my things was incorrect, please explain me.<br>
              <br>
              Пнд 06 Янв 2014 16:05:06 +0500, Nicolas Gillet <<a target="_blank" moz-do-not-send="true" href="/compose/?adb_to=nicolas.gillet@market-ip.com">nicolas.gillet@market-ip.com</a>>

              написал:<o:p></o:p></p>
            <div>
              <p><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Hello

                  guys,</span><o:p></o:p></p>
              <p><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
              <p><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D" lang="EN-US">That implementation won’t be efficient I
                  think.</span><o:p></o:p></p>
              <p><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D" lang="EN-US">First thing you must know about using
                  real time weighting is that you won’t be able to use
                  contractions hierarchies unless you re-contract the
                  whole graph any time you change any edge’s weight.</span><o:p></o:p></p>
              <p><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D" lang="EN-US">Without contraction you’ll have a serious
                  downgrade of performances.</span><o:p></o:p></p>
              <p><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D" lang="EN-US"> </span><o:p></o:p></p>
              <p><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D" lang="EN-US">If you still want to perform real time
                  weighting, the best option is to update the edge’s
                  weight with your live traffic info, so updating the
                  flags.</span><o:p></o:p></p>
              <p><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D" lang="EN-US"> </span><o:p></o:p></p>
              <p><span lang="EN-US">> 1.) Which flags are included
                  and which position they are set?<br>
                </span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D" lang="EN-US">This depends on the flag encoders you
                  use, check the CarFlagEncoder class.</span><o:p></o:p></p>
              <p><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D" lang="EN-US"> </span><o:p></o:p></p>
              <p><span lang="EN-US">> 2.) Is there a convinient way
                  to get a single EdgeIteratorState Object directly by
                  poviding its ID?</span><o:p></o:p></p>
              <p><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D" lang="EN-US">If you know it’s GraphHopper’s ID, you
                  can do graph.getEdgeProps(edgeId, Integer.MIN_VALUE)
                  but you’ll have to maintain a way to link OSM ID’s
                  with GH’s ids.</span><o:p></o:p></p>
              <p><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D" lang="EN-US"> </span><o:p></o:p></p>
              <p><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D" lang="EN-US">Regards,</span><o:p></o:p></p>
              <p><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D" lang="EN-US"> </span><o:p></o:p></p>
              <p><span style="font-size:10.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Nicolas

                  GILLET</span><o:p></o:p></p>
              <p><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
              <p><b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span></b><o:p></o:p></p>
              <p><b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Market-IP

                    –</span></b><i><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"></span></i><i><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#404040">Creating

                    Mobile Intelligence</span></i><o:p></o:p></p>
              <p><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Phone :

                  +32 81 33 11 11 </span><o:p></o:p></p>
              <p><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Fax :

                  +32 81 33 11 10</span><o:p></o:p></p>
              <p><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><a moz-do-not-send="true" href="http://www.market-ip.com/" target="_blank">www.market-ip.com</a>
                  – <a moz-do-not-send="true" href="http://www.telefleet.com/" target="_blank">www.telefleet.com</a>
                  – <a moz-do-not-send="true" href="http://www.geoplanning.net/" target="_blank">
                    www.geoplanning.net</a> – <a moz-do-not-send="true" href="http://www.drivexpert.net/" target="_blank">www.drivexpert.net</a>
                </span><o:p></o:p></p>
              <p><a moz-do-not-send="true" href="http://www.linkedin.com/groups/MarketIP-4289716?gid=4289716&trk=hb_side_g" target="_blank"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D;text-decoration:none"><img moz-do-not-send="true" xsscleaned="_x0000_i1025" alt="Description :
                      cid:image003.png@01CD5521.849F3340" border="0" height="25" width="30"></span></a><o:p></o:p></p>
              <p><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
              <p><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"" lang="FR">De :</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"" lang="FR"> <a target="_blank" moz-do-not-send="true" href="/compose/?adb_to=lanmaster@hotmail.ru">lanmaster@hotmail.ru</a>
                  [<a target="_blank" moz-do-not-send="true" href="/compose/?adb_to=lanmaster@hotmail.ru">mailto:lanmaster@hotmail.ru</a>]
                  <br>
                  <b>Envoyé :</b> lundi 6 janvier 2014 11:47<br>
                  <b>À :</b> Jrgen Zornig<br>
                  <b>Cc :</b> GraphHopper Java routing engine<br>
                  <b>Objet :</b> Re: [GraphHopper] How to ­consider
                  traffic jam when­ route on road network?</span><o:p></o:p></p>
              <p> <o:p></o:p></p>
              <p>Hello, Jrgen!<br>
                <br>
                I think about this implementation:<br>
                1. We have in-memory arraylist, that contains infos
                about traffic jam<br>
                2. We have function that can calculate weight of way by
                two coordinate pairs (from node / to node)<br>
                3. We have modification on Graphhopper's route calculate
                algorithm, that can request weight from our weight
                function (2) and summarize it with original
                Graphhopper's weight.<br>
                <br>
                Can that implementation be useful, how do you think?<br>
                <br>
                <br>
                Пнд 06 Янв 2014 15:16:52 +0500, Jrgen Zornig <<a moz-do-not-send="true" href="/compose/?adb_to=juergen.zornig@gmail.com" target="_blank">juergen.zornig@gmail.com</a>>
                написал:<o:p></o:p></p>
              <div>
                <p>I am also trying to figure out how real time graph
                  modifications and short and temporary events should be
                  handled for the routing.<br>
                  <br>
                  I assume you use to OSM graph? That makes things more
                  complicated I think,because I have not found a
                  function to retrieve a single Edge without iterating
                  over and over the whole graph. Even when you know the
                  Edge Id, you have to iterate over all Edges.<br>
                  <br>
                  In our scenario, we use a different (our own) graph,
                  and while loading it, I build up a HashMap for all
                  EdgeIteratorState Objects I have generated during
                  loading. So I can easily find a corresponding Edge for
                  a given TrafficJam, either by directly referencing it
                  over our EdgeIds or by finding out the Id via the
                  LocationIndex (NodeIds and the referenced EdgeIds).<br>
                  <br>
                  When having the corresponding EdgeIteratorState Object
                  it should be simple to deactivate the Edge by calling
                  setFlags(), but I also have no clue yet, how to set
                  this bitmask because I couldn't find any documentation
                  on to flags itself.<br>
                  <br>
                  So I want to add to this question: <br>
                  <br>
                  1.) Which flags are included and which position they
                  are set?<br>
                  2.) Is there a convinient way to get a single
                  EdgeIteratorState Object directly by poviding its ID?<br>
                  <br>
                  I am in need of these functions to handle real time
                  traffic data on the graph. <br>
                  <br>
                  P.S. Perhaps we can figure it out by ourselves, so
                  Peter doesn't have to answer every single question ;)
                  <br>
                  <br>
                  Regards,<br>
                  <br>
                  Juergen<br>
                  <br>
                  Am 06.01.2014 09:54, schrieb <a moz-do-not-send="true" href="/compose/?adb_to=lanmaster@hotmail.ru" target="_blank"> lanmaster@hotmail.ru</a>:<o:p></o:p></p>
              </div>
              <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
                <div>
                  <p>Graphhopper is a project for finding routes over a
                    road network. It also provides functionality for
                    weighting this routing like <code><span style="font-size:10.0pt">fastest</span></code>
                    or <code><span style="font-size:10.0pt">shortest</span></code>
                    path e.g. via the FastestWeighting class. Now, the
                    question is: how can we extend <code><span style="font-size:10.0pt">Graphhopper</span></code>
                    to use the speed data we get from our traffic
                    provider in realtime?<o:p></o:p></p>
                  <p>As I can see:<o:p></o:p></p>
                  <ol start="1" type="1">
                    <li xsscleaned="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;mso-list:l0
                      level1 lfo1"> We must create a function that gets
                      traffic jam data from our database.<o:p></o:p></li>
                    <li xsscleaned="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;mso-list:l0
                      level1 lfo1"> We must force use that modified
                      function (Encoder?) somewhere in Graphhopper <code>
                        <span style="font-size:10.0pt">route()</span></code>
                      function. Do I think right?<o:p></o:p></li>
                  </ol>
                  <p>Please show me how we can do this by example.<o:p></o:p></p>
                </div>
                <p style="margin-bottom:12.0pt"><br>
                  <br>
                  <o:p></o:p></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" target="_blank">GraphHopper@openstreetmap.org</a><o:p></o:p></pre>
                <pre><a moz-do-not-send="true" href="https://lists.openstreetmap.org/listinfo/graphhopper" target="_blank">https://lists.openstreetmap.org/listinfo/graphhopper</a><o:p></o:p></pre>
              </blockquote>
              <p> <o:p></o:p></p>
            </div>
          </div>
          <br>
          <fieldset xsscleaned="mimeAttachmentHeader"></fieldset>
          <br>
          <pre wrap="">_______________________________________________
GraphHopper mailing list
<a moz-do-not-send="true" target="_blank" xsscleaned="moz-txt-link-abbreviated" href="mailto:GraphHopper@openstreetmap.org">GraphHopper@openstreetmap.org</a>
<a moz-do-not-send="true" target="_blank" xsscleaned="moz-txt-link-freetext" href="https://lists.openstreetmap.org/listinfo/graphhopper">https://lists.openstreetmap.org/listinfo/graphhopper</a>
</pre>
        </blockquote>
        <br>
      </blockquote>
      <br>
      <br>
      --<br>
      <br>
    </blockquote>
    <br>
  


</blockquote><br><br>--<br>
<br>