Hi,<br><br>Here is an interesting look into the data in ways table:<br><br>pgrouting-workshop=# select round(avg(length)*10000) as avg, round(min(length)*10000) as min, round(max(length)*10000) as max,count(*) as count, class_id from ways group by class_id order by avg desc;<br>
<br> avg  | min  |  max  | count | class_id <br>------+------+-------+-------+----------<br> 5320 |  250 | 12163 |    21 |      101<br> 2135 | 1885 |  2385 |     2 |      111<br> 1970 |  396 |  5168 |    17 |      102<br>
 1343 |   10 | 27485 |   234 |      106<br> 1115 |   33 |  7964 |   221 |      108<br> 1037 |   14 | 20020 |   248 |      109<br>  938 |    9 | 23142 |  2761 |      110<br>  837 |   21 |  2212 |    43 |      100<br>  626 |    8 |  3327 |    90 |      112<br>
  619 |   26 |  9089 |   252 |      119<br>  486 |  123 |  1618 |    11 |      117<br>  473 |    7 | 16582 |  1259 |      114<br>  364 |   97 |  1578 |    45 |      122<br>  260 |    4 |   718 |   109 |      401<br>(14 rows)<br>
<br>So, I am going by the average length figure and considering class_id = (1001,111,102) as Type I (major_highways), which will be affected most by the traffic.<br><br>class_id = (106,108,109,110,100) as Type II (minor_highways) which be comparatively less populated.<br>
<br>class_id = (112,119,117,114,122,401) as Type III (streets) which will have least traffic.<br><br>We want to have model such that during traffic hours the shortest path should go through streets.<br><br>So, I am dividing day into following intervals, hope it sounds reasonable. I will write the corresponding plsql function that will generate the data accordingly. Note that the speed is in percentage of average speed. Since, we want to deal with time, we can effectively increase the lengths of the edges by same factor and assume speed as constant.<br>
<br><br>



        
        
        
        
        <style>body, div, table, thead, tbody, tfoot, tr, th, td, p { font-family: "Arial"; font-size: x-small; }</style>
        

<table rules="NONE" cols="4" frame="VOID" border="0" cellspacing="0">
        <colgroup><col width="98"><col width="108"><col width="113"><col width="115"></colgroup>
        <tbody>
                <tr>
                        <td width="98" height="19" align="JUSTIFY">Time Interval</td>
                        <td width="108" align="CENTER">Speed for Type I</td>
                        <td width="113" align="CENTER">Speed for Type II</td>
                        <td width="115" align="CENTER">Speed for Type III</td>
                </tr>
                <tr>
                        <td height="19" align="JUSTIFY"><br></td>
                        <td align="CENTER"><br></td>
                        <td align="CENTER"><br></td>
                        <td align="CENTER"><br></td>
                </tr>
                <tr>
                        <td height="36" align="JUSTIFY">10 PM – 6 AM</td>
                        <td align="CENTER">100</td>
                        <td align="CENTER">100</td>
                        <td align="CENTER">100</td>
                </tr>
                <tr>
                        <td height="19" align="JUSTIFY">6 AM – 7 AM</td>
                        <td align="CENTER">95</td>
                        <td align="CENTER">90</td>
                        <td align="CENTER">100</td>
                </tr>
                <tr>
                        <td height="19" align="JUSTIFY">7 AM – 8 AM</td>
                        <td align="CENTER">80</td>
                        <td align="CENTER">75</td>
                        <td align="CENTER">90</td>
                </tr>
                <tr>
                        <td height="19" align="JUSTIFY">8 AM – 9 AM</td>
                        <td align="CENTER">50</td>
                        <td align="CENTER">45</td>
                        <td align="CENTER">85</td>
                </tr>
                <tr>
                        <td height="36" align="JUSTIFY">9 AM – 10 AM</td>
                        <td align="CENTER">60</td>
                        <td align="CENTER">55</td>
                        <td align="CENTER">85</td>
                </tr>
                <tr>
                        <td height="36" align="JUSTIFY">10 AM – 11 AM</td>
                        <td align="CENTER">90</td>
                        <td align="CENTER">85</td>
                        <td align="CENTER">95</td>
                </tr>
                <tr>
                        <td height="36" align="JUSTIFY">11 AM – 5 PM</td>
                        <td align="CENTER">100</td>
                        <td align="CENTER">100</td>
                        <td align="CENTER">100</td>
                </tr>
                <tr>
                        <td height="19" align="JUSTIFY">5 PM – 6 PM</td>
                        <td align="CENTER">90</td>
                        <td align="CENTER">85</td>
                        <td align="CENTER">95</td>
                </tr>
                <tr>
                        <td height="19" align="JUSTIFY">6 PM – 7 PM</td>
                        <td align="CENTER">75</td>
                        <td align="CENTER">70</td>
                        <td align="CENTER">90</td>
                </tr>
                <tr>
                        <td height="19" align="JUSTIFY">7 PM – 8 PM</td>
                        <td align="CENTER">50</td>
                        <td align="CENTER">45</td>
                        <td align="CENTER">85</td>
                </tr>
                <tr>
                        <td height="19" align="JUSTIFY">8 PM – 9 PM</td>
                        <td align="CENTER">60</td>
                        <td align="CENTER">55</td>
                        <td align="CENTER">85</td>
                </tr>
                <tr>
                        <td height="36" align="JUSTIFY">9 PM – 10 PM<br></td>
                        <td align="CENTER">95</td>
                        <td align="CENTER">90</td>
                        <td align="CENTER">95</td>
                </tr>
        </tbody>
</table>
<br><br>Any feedback is welcome.<br><br>I am currently stuck with a bug in the core time-dependent function, 
there seems to be a problem with non-integer data. Will try and fix that
 soon.<br><br><br><div class="gmail_quote">On Wed, Jun 15, 2011 at 7:26 AM, Jay Mahadeokar <span dir="ltr">&lt;<a href="mailto:jai.mahadeokar@gmail.com">jai.mahadeokar@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br><br><div class="gmail_quote"><div class="im">On Sun, Jun 12, 2011 at 8:00 PM, Stephen Woodbridge <span dir="ltr">&lt;<a href="mailto:woodbri@swoodbridge.com" target="_blank">woodbri@swoodbridge.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Jay,<br>
<br>
Try:<br>
<br>
select class_id, count(*) as cnt from ways group by class_id oder by classid;<br>
<br>
Typically you should a a distribution in real world data something like:<br>
<br>
5% limited access major highways<br>
15% major roads<br>
75% minor roads<br>
5% trails, pedestrian ways, etc<br>
<br></blockquote></div><div><br>Hi, <br><br>We have got following data in the pgrouting-workshop ways table.<br></div><div><br>pgrouting-workshop=# select distinct(count(class_id)) as no_of_entries,class_id from ways group by class_id order by no_of_entries;<br>

 no_of_entries | class_id <br>---------------+----------<br>             2 |      111<br>            11 |      117<br>            17 |      102<br>            21 |      101<br>            43 |      100<br>            45 |      122<br>

            90 |      112<br>           109 |      401<br>           221 |      108<br>           234 |      106<br>           248 |      109<br>           252 |      119<br>          1259 |      114<br>          2761 |      110<br>

(14 rows)<br><br><br>The classes table in routing database gives more information on the class_id field.  Also available here: <a href="http://workshop.pgrouting.org/chapters/advanced.html" target="_blank">http://workshop.pgrouting.org/chapters/advanced.html</a><br>

<br>So, we have: <br><br>class_id    name                no_of_entries<br><br>110           track               2761<br>114           path                1259<br>119           steps               252<br>109           service            248<br>

106           primary            234<br>108           living_street     221<br>401           roundabout      109<br><br>These are the major class_types with more than 100 entries in ways table.  <br><br>Steve had earlier suggested following idea for time dependent data generation:<div class="im">
<br>
<br> &quot;If we think about &quot;rush hour&quot; around a major city, the highways (based 
on road class) flowing into the city in the morning would get reduced 
average speeds you could apply curve like average speed*percent based on
 6am (90%), 7am(75%), 8am(45%), 9am(50%), 10am(85%) and do something 
similar in the evening rush. It might be too hard to figure on direction
 of flow in/out bound so apply the curve to all traffic. The assumption 
is that the highways are congested which will force traffic onto side 
streets. You might want to also reduce the lower class speeds by say a 
constant 80% during rush hour.&quot;<br><br></div>So, what classes should I consider as highways, what classes as streets and so on? Or What should be the pattern of speed changes in various classes? <br><br>The main focus would be, we should be routed through less congested areas during rush hours right?<br>

<br>Once we finalise this model, I can write the plsql function to generate the corresponding data.<br>
<br><br><br></div><div><div></div><div class="h5"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Well in the US anyway. Also if this is OSM data then you might get a better clue on classes by looking to that .... OH!, look what I found in google :)<br>
<br>
<a href="http://workshop.pgrouting.org/chapters/advanced.html" target="_blank">http://workshop.pgrouting.org/chapters/advanced.html</a><br>
<br>
Looks like first digit is type and the three digits are from the classes table.<br>
<br>
-Steve<div><br>
<br>
On 6/12/2011 4:33 AM, Jay Mahadeokar wrote:<br>
</div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div>
<br>
<br>
On Sun, Jun 12, 2011 at 1:32 PM, Anton Patrushev<br></div>
&lt;<a href="mailto:anton.patrushev@georepublic.de" target="_blank">anton.patrushev@georepublic.de</a> &lt;mailto:<a href="mailto:anton.patrushev@georepublic.de" target="_blank">anton.patrushev@georepublic.de</a>&gt;&gt;<div>

<br>
wrote:<br>
<br>
    Hi Jay,<br>
<br>
    No, there was no specific meaning, just king of cyphering - first<br>
    digit for road class and then two last digits for road type.<br>
<br>
<br>
Hi Anton,<br>
<br>
So, as you said last 2 digits are for road type. I can see they are<br>
mainly 00, 01, 02, 06, 08, 09, 10, 11, 12 ,14, 17.<br>
<br>
Road class is just 1 or 4.<br>
<br>
Can I differentiate major highways, minor highways, streets etc using<br>
this info?<br>
<br>
    Anton.<br>
<br>
    On 6/12/11, Jay Mahadeokar &lt;<a href="mailto:jai.mahadeokar@gmail.com" target="_blank">jai.mahadeokar@gmail.com</a><br></div><div><div></div><div>
    &lt;mailto:<a href="mailto:jai.mahadeokar@gmail.com" target="_blank">jai.mahadeokar@gmail.com</a>&gt;&gt; wrote:<br>
     &gt;&gt; Hi Jay,<br>
     &gt;&gt;<br>
     &gt;&gt; I think that instead of just random times, I would take a different<br>
     &gt;&gt; approach to generate this data. If we think about &quot;rush hour&quot;<br>
    around a<br>
     &gt;&gt; major<br>
     &gt;&gt; city, the highways (based on road class) flowing into the city<br>
    in the<br>
     &gt;&gt; morning would get reduced average speeds you could apply curve like<br>
     &gt;&gt; average<br>
     &gt;&gt; speed*percent based on 6am (90%), 7am(75%), 8am(45%), 9am(50%),<br>
    10am(85%)<br>
     &gt;&gt; and do something similar in the evening rush. It might be too<br>
    hard to<br>
     &gt;&gt; figure<br>
     &gt;&gt; on direction of flow in/out bound so apply the curve to all<br>
    traffic. The<br>
     &gt;&gt; assumption is that the highways are congested which will force<br>
    traffic<br>
     &gt;&gt; onto<br>
     &gt;&gt; side streets. You might want to also reduce the lower class<br>
    speeds by say<br>
     &gt;&gt; a<br>
     &gt;&gt; constant 80% during rush hour.<br>
     &gt;&gt;<br>
     &gt;&gt; If we can get OSM data then it should be easy to populate the<br>
    table with<br>
     &gt;&gt; that data.<br>
     &gt;&gt;<br>
     &gt;&gt; -Steve<br>
     &gt;&gt;<br>
     &gt;<br>
     &gt; I am trying to write plpgsql query to generate time-dependent data<br>
     &gt; corresponding to the ways table in pgrouting workshop. As<br>
    suggested by Steve<br>
     &gt; above, instead of generating random data, I will follow patterns<br>
    (see above<br>
     &gt; message) so that the data is nearer to the real worlds scenario.<br>
     &gt;<br>
     &gt; So, now I need to make distinction between highways, streets etc.<br>
    I saw the<br>
     &gt; attribute class_id in ways table. It has 14 distinct values:<br>
     &gt;  class_id<br>
     &gt;<br>
     &gt; ----------<br>
     &gt;<br>
     &gt;<br>
     &gt; 102<br>
     &gt;<br>
     &gt;<br>
     &gt; 122<br>
     &gt;<br>
     &gt;<br>
     &gt; 106<br>
     &gt;<br>
     &gt;<br>
     &gt; 111<br>
     &gt;<br>
     &gt;<br>
     &gt; 108<br>
     &gt;<br>
     &gt;<br>
     &gt; 100<br>
     &gt;<br>
     &gt;<br>
     &gt; 109<br>
     &gt;<br>
     &gt;<br>
     &gt; 112<br>
     &gt;<br>
     &gt;<br>
     &gt; 101<br>
     &gt;<br>
     &gt;<br>
     &gt; 110<br>
     &gt;<br>
     &gt;<br>
     &gt; 401<br>
     &gt;<br>
     &gt;<br>
     &gt; 119<br>
     &gt;<br>
     &gt;<br>
     &gt; 117<br>
     &gt;<br>
     &gt;       114<br>
     &gt;<br>
     &gt; Any specific meaning attached to these values? I did not find any<br>
     &gt; information on the pgRouting-workshop website [1].<br>
     &gt;<br>
     &gt;<br>
     &gt; Thanks in advance.<br>
     &gt;<br>
     &gt; [1] <a href="http://workshop.pgrouting.org/chapters/topology.html" target="_blank">http://workshop.pgrouting.org/chapters/topology.html</a><br>
     &gt;<br>
     &gt; --<br>
     &gt; Regards,<br>
     &gt; -Jay Mahadeokar<br>
     &gt;<br>
<br>
<br>
    --<br>
    Georepublic UG (haftungsbeschränkt)<br>
    Salzmannstraße 44,<br>
    81739 München, Germany<br>
<br>
    Anton Patrushev<br>
    CTO<br>
<br>
    eMail: <a href="mailto:anton.patrushev@georepublic.de" target="_blank">anton.patrushev@georepublic.de</a><br></div></div>
    &lt;mailto:<a href="mailto:anton.patrushev@georepublic.de" target="_blank">anton.patrushev@georepublic.de</a>&gt;<div><br>
    Web: <a href="http://georepublic.de" target="_blank">http://georepublic.de</a><br>
<br>
    Tel: +49 (089) 420 959 519<br></div>
    Sip: <a href="mailto:1959519@sipgate.de" target="_blank">1959519@sipgate.de</a> &lt;mailto:<a href="mailto:1959519@sipgate.de" target="_blank">1959519@sipgate.de</a>&gt;<div><br>
<br>
    Commercial register: Amtsgericht München, HRB 181428<br>
    CEO: Daniel Kastl<br>
    _______________________________________________<br>
    pgrouting-dev mailing list<br></div>
    <a href="mailto:pgrouting-dev@lists.osgeo.org" target="_blank">pgrouting-dev@lists.osgeo.org</a> &lt;mailto:<a href="mailto:pgrouting-dev@lists.osgeo.org" target="_blank">pgrouting-dev@lists.osgeo.org</a>&gt;<div>
<br>
    <a href="http://lists.osgeo.org/mailman/listinfo/pgrouting-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/pgrouting-dev</a><br>
<br>
<br>
<br>
<br>
--<br>
Regards,<br>
-Jay Mahadeokar<br>
<br>
<br>
<br>
_______________________________________________<br>
pgrouting-dev mailing list<br>
<a href="mailto:pgrouting-dev@lists.osgeo.org" target="_blank">pgrouting-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/pgrouting-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/pgrouting-dev</a><br>
</div></blockquote><div><div></div><div>
<br>
_______________________________________________<br>
pgrouting-dev mailing list<br>
<a href="mailto:pgrouting-dev@lists.osgeo.org" target="_blank">pgrouting-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/pgrouting-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/pgrouting-dev</a><br>
</div></div></blockquote></div></div></div><br><br clear="all"><br>-- <br>Regards,<br><font color="#888888">-Jay Mahadeokar<br><br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Regards,<br>-Jay Mahadeokar<br><br>