jeep-and-bus-schedules.html 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <!DOCTYPE html>
  2. <html lang="en-us">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="generator" content="Hugo 0.92.0" />
  6. <meta name="viewport" content="width=device-width, initial-scale=1">
  7. <link rel="stylesheet" href="/assets/css/theme.css">
  8. <link rel="alternate" href="/rss.xml" type="application/rss+xml" title="Pleasant Programmer">
  9. <script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script>
  10. <script type="text/javascript">try{Typekit.load();}catch(e){}</script>
  11. <title>Jeep and Bus Schedules - Pleasant Programmer</title>
  12. </head>
  13. <body>
  14. <header id="header" role="banner">
  15. <div id="thomas">
  16. <img src="/assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS">
  17. <img src="/assets/img/thomas.png" alt="Pleasant Programmer">
  18. </div>
  19. <h1 class="site-title"><a href="/">Pleasant Programmer</a></h1>
  20. <nav id="menu" role="navigation">
  21. <ul>
  22. <li><a href="/pages/projects.html">projects</a></li>
  23. <li><a href="/posts.html">archives</a></li>
  24. <li><a href="/tags.html">tags</a></li>
  25. <li><a href="/rss.xml">rss</a></li>
  26. </ul>
  27. </nav>
  28. </header>
  29. <div id="container">
  30. <main id="content" role="main">
  31. <article itemscope itemtype="http://schema.org/BlogPosting">
  32. <h1 class="p-name entry-title" itemprop="headline name">
  33. <a href="/posts/jeep-and-bus-schedules.html">Jeep and Bus Schedules</a></h1>
  34. <small>
  35. <span class="dateline">Posted: <time itemprop="datePublished" datetime="2013-07-28">2013-07-28</time></span>
  36. | More posts about
  37. <a class="tag p-category" href="/tags/philippine-transit-app.html" rel="tag">
  38. philippine-transit-app
  39. </a>
  40. <a class="tag p-category" href="/tags/programming.html" rel="tag">
  41. programming
  42. </a>
  43. </small>
  44. <div class="e-content entry-content" itemprop="entry-text">
  45. <p>Wouldn&rsquo;t it be wonderful if there were no buses or jeepneys in the Philippines over the weekends? It would truly be a cyclist&rsquo;s paradise. Imagine biking along EDSA, normally that would be a death sentence, but according to the GTFS data, you shouldn&rsquo;t worry. I can assure you, it&rsquo;s still a death sentence.</p>
  46. <p>The GTFS spec defines 2 ways of statically specifying trip schedules. You can define the exact times that a service will arrive at a stop. You can also specify between what times the service is active and how often a new bus or jeep leaves the first stop. You also define which days those rules apply. You could say every MWF, the bus operates from 9:00AM to 9:00PM and every TTH, the bus services from 3:00AM to 11:00PM.</p>
  47. <p>This should be sufficient in theory, but real world conditions like traffic or the weather could throw the schedules off. To solve this, there&rsquo;s another spec, GTFS-realtime. This allows transit agencies to push temporary schedule updates and service announcements.</p>
  48. <p>Like much everything else about the Philippine transit system, there aren&rsquo;t really any &ldquo;schedules&rdquo; to speak of. It&rsquo;s generally whenever the buses or jeeps feel like it. So we have no static schedules. We don&rsquo;t have a central agency or the tracking technology to make it feasible to push updates via GTFS-RT.</p>
  49. <p>Ideally, we shouldn&rsquo;t bother inputting the schedule information into GTFS. Only the route data is really important for jeeps and buses. However, the schedule information is required in the GTFS, and routing apps wouldn&rsquo;t work without it. So we have to add a reasonable trip schedule for jeeps and buses.</p>
  50. <p>The current GTFS data does define these trip schedules. We assume that jeeps and buses operate between 6:00AM and 11:00PM and a new jeep passes by every 10 minutes. Also, jeeps and buses are defined to only operate on weekdays.</p>
  51. <p>While there might be jeeps who change routes or don&rsquo;t operate on weekends, I&rsquo;m pretty sure that jeeps and buses run on weekends. We&rsquo;ll have to fix it ourselves temporarily since there&rsquo;s no central GTFS feed yet.</p>
  52. <div class="highlight"><pre tabindex="0" style="color:#e5e5e5;background-color:#000;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-sh" data-lang="sh"><span style="color:#007f7f"># 724594 seems to be the service id used by jeeps and buses</span>
  53. sed -i .bak <span style="color:#0ff;font-weight:bold">&#39;/^724594/ s/0,0/1,1/&#39;</span> calendar.txt
  54. </code></pre></div><p>Another thing we could do is to adjust the time between buses, although the improvement is arguable. With the current 10 minutes between jeeps, it might provide some routes a significant advantage just because the timing is right. So you might get differing route suggestions depending on what time you planned the route. This makes sense when you&rsquo;re sure what the times are, so you can minimize the wait, but with jeeps, you never really know how long the wait will actually be.</p>
  55. <p>If we set the frequency to one minute, it <em>might</em> give better routes by eliminating the timing issue. Or not, it&rsquo;s kind of hard to tell.</p>
  56. <div class="highlight"><pre tabindex="0" style="color:#e5e5e5;background-color:#000;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-sh" data-lang="sh"><span style="color:#007f7f"># jeep and bus route ids tend to start with 72</span>
  57. sed -i .bak <span style="color:#0ff;font-weight:bold">&#39;/^72/ s/,600/,60/&#39;</span> frequencies.txt
  58. </code></pre></div><p>Overall, the problems we&rsquo;re having is a symptom of the mismatch between our transit system and the GTFS. It would be great if our transit system gets better and we don&rsquo;t need to do hackish things for it to fit the GTFS, but that&rsquo;s still a dream. For now, all we can really do is fit a triangle into a square hole.</p>
  59. </div>
  60. <aside class="postpromonav">
  61. <nav>
  62. <ul class="pager clearfix">
  63. <li class="previous">
  64. <a href="/posts/highways-in-otp.html" rel="prev" title="Highways in OTP">&larr; Previous post</a>
  65. </li>
  66. <li class="next">
  67. <a href="/posts/geocoding-services.html" rel="next" title="Geocoding Services">Next post &rarr;</a>
  68. </li>
  69. </ul>
  70. </nav>
  71. </aside>
  72. <section class="comments">
  73. <script
  74. data-isso="https://isso.pleasantprogrammer.com/"
  75. data-isso-require-author="true"
  76. data-isso-vote="false"
  77. src="https://isso.pleasantprogrammer.com/js/embed.min.js">
  78. </script>
  79. <section id="isso-thread"></section>
  80. </section>
  81. </article>
  82. </main>
  83. <footer id="footer" role="contentinfo">
  84. <p>
  85. <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US">
  86. <img alt="CC-BY-SA" style="border-width:0" src="https://licensebuttons.net/l/by-sa/3.0/80x15.png">
  87. </a> &copy; 2022 Thomas Dy - Powered by <a href="http://gohugo.io">Hugo</a></p>
  88. </footer>
  89. </div>
  90. <script src="/assets/js/konami.js"></script>
  91. <script>
  92. var easter_egg = new Konami();
  93. easter_egg.code = function() {
  94. var el = document.getElementById('thomas');
  95. if(el.className == "whoa") {
  96. el.className = "";
  97. }
  98. else {
  99. el.className = "whoa";
  100. }
  101. document.body.scrollTop = document.documentElement.scrollTop = 0;
  102. }
  103. easter_egg.load();
  104. </script>
  105. </body>
  106. </html>