123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249 |
- <!DOCTYPE html>
- <html lang="en-us">
- <head>
- <meta charset="utf-8">
- <meta name="generator" content="Hugo 0.36" />
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="stylesheet" href="/assets/css/theme.css">
- <link rel="alternate" href="/rss.xml" type="application/rss+xml" title="Pleasant Programmer">
- <script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script>
- <script type="text/javascript">try{Typekit.load();}catch(e){}</script>
- <title>Pleasant Programmer</title>
- </head>
- <body>
- <header id="header" role="banner">
- <div id="thomas">
- <img src="/assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS">
- <img src="/assets/img/thomas.png" alt="Pleasant Programmer">
- </div>
- <h1 class="site-title"><a href="/">Pleasant Programmer</a></h1>
- <nav id="menu" role="navigation">
- <ul>
- <li class="twitter">
- <a href="http://twitter.com/pleasantprog">@pleasantprog</a>
- </li>
- <li><a href="/pages/projects.html">projects</a></li>
- <li><a href="/posts.html">archives</a></li>
- <li><a href="/tags.html">tags</a></li>
- <li><a href="/rss.xml">rss</a></li>
- </ul>
- </nav>
- </header>
- <div id="container">
- <main id="content" role="main">
- <div class="postindex">
-
- <article class="h-entry post-text" itemscope itemtype="http://schema.org/Blog">
- <header>
- <h1 class="p-name entry-title" itemprop="headline">
- <a href="/posts/jeep-and-bus-schedules.html" class="u-url">Jeep and Bus Schedules</a>
- </h1>
- </header>
- <div class="e-content entry-content">
- <p>Wouldn’t it be wonderful if there were no buses or jeepneys in the Philippines over the weekends? It would truly be a cyclist’s paradise. Imagine biking along EDSA, normally that would be a death sentence, but according to the GTFS data, you shouldn’t worry. I can assure you, it’s still a death sentence.</p>
- <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>
- <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’s another spec, GTFS-realtime. This allows transit agencies to push temporary schedule updates and service announcements.</p>
- <p>Like much everything else about the Philippine transit system, there aren’t really any “schedules” to speak of. It’s generally whenever the buses or jeeps feel like it. So we have no static schedules. We don’t have a central agency or the tracking technology to make it feasible to push updates via GTFS-RT.</p>
- <p>Ideally, we shouldn’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’t work without it. So we have to add a reasonable trip schedule for jeeps and buses.</p>
- <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>
- <p>While there might be jeeps who change routes or don’t operate on weekends, I’m pretty sure that jeeps and buses run on weekends. We’ll have to fix it ourselves temporarily since there’s no central GTFS feed yet.</p>
- <div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><code class="language-sh" data-lang="sh"><span></span><span style="color: #408080; font-style: italic"># 724594 seems to be the service id used by jeeps and buses</span>
- sed -i .bak <span style="color: #BA2121">'/^724594/ s/0,0/1,1/'</span> calendar.txt
- </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’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>
- <p>If we set the frequency to one minute, it <em>might</em> give better routes by eliminating the timing issue. Or not, it’s kind of hard to tell.</p>
- <div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><code class="language-sh" data-lang="sh"><span></span><span style="color: #408080; font-style: italic"># jeep and bus route ids tend to start with 72</span>
- sed -i .bak <span style="color: #BA2121">'/^72/ s/,600/,60/'</span> frequencies.txt
- </code></pre></div>
- <p>Overall, the problems we’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’t need to do hackish things for it to fit the GTFS, but that’s still a dream. For now, all we can really do is fit a triangle into a square hole.</p>
- </div>
- <small class="dateline">Posted: <time class="published dt-published" itemprop="datePublished" datetime="2013-07-28">2013-07-28</time></small>
- | <small class="commentline"><a href="/posts/jeep-and-bus-schedules.html#isso-thread">Comments</a></small>
- </article>
- </article>
-
- <article class="h-entry post-text" itemscope itemtype="http://schema.org/Blog">
- <header>
- <h1 class="p-name entry-title" itemprop="headline">
- <a href="/posts/highways-in-otp.html" class="u-url">Highways in OTP</a>
- </h1>
- </header>
- <div class="e-content entry-content">
- <p>One of the weird things that happens with OTP is sometimes it gives absurdly roundabout routes. Here is OTP’s suggested route for walking from UP to Ateneo:</p>
- <p><img src="../galleries/transit/otproundabout.png" alt="Roundabout route from UP to Ateneo" /></p>
- <p>This is just so hilariously wrong. It’s much simpler to just walk along Katipunan Avenue.</p>
- <p>OTP couldn’t possibly be that dumb though, so there must be something we’re doing wrong. If you notice, Katipunan Avenue is colored red compared to the other streets. OTP seems to be avoiding any path that goes along Katipunan Avenue. The problem might have something to do with the “road type” designated to Katipunan.</p>
- <p>Apparently, by default OTP will consider roads of type <code>trunk</code> to be non-walkable and non-bikable. This is documented in the <a href="http://wiki.openstreetmap.org/wiki/OpenTripPlanner">OpenStreetMap wiki</a> and the <a href="https://github.com/openplans/OpenTripPlanner/wiki/GraphBuilder#permissions-and-bicycle-safety">OTP wiki</a> as well. There are actually multiple ways to go about this then. The first solution that came to mind was to just edit the original OSM XML file.</p>
- <div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><code class="language-text" data-lang="text"><span></span>sed -i .bak s/trunk/primary/g manila.osm
- </code></pre></div>
- <p>And rebuild the graph. It doesn’t really matter much because the OSM data isn’t used to render the maps. It’s just used to build the routing data. This is actually what I did for <a href="http://maps.pleasantprogrammer.com">maps.pleasantprogrammer.com</a>.</p>
- <p>It’s also possible to set the default way properties in OTP. Instead of disallowing walking and biking on <code>highway=trunk</code> we could allow that. This is not much better than the <code>sed</code> solution though. It’s better since you keep the weighting done by OTP, but you’re still saying that all trunks are walkable which might not be the case.</p>
- <p>The most correct way to actually fix this is to go through each of the trunks and specifying <code>foot=yes</code> and <code>bicycle=yes</code> for those trunks that are actually walkable. You could either do this locally with the dumped data, or contribute it directly to OSM. I’m not sure on the particulars with updating OSM though.</p>
- </div>
- <small class="dateline">Posted: <time class="published dt-published" itemprop="datePublished" datetime="2013-07-24">2013-07-24</time></small>
- | <small class="commentline"><a href="/posts/highways-in-otp.html#isso-thread">Comments</a></small>
- </article>
- </article>
-
- <article class="h-entry post-text" itemscope itemtype="http://schema.org/Blog">
- <header>
- <h1 class="p-name entry-title" itemprop="headline">
- <a href="/posts/elevation-data-in-otp.html" class="u-url">Elevation Data in OTP</a>
- </h1>
- </header>
- <div class="e-content entry-content">
- <p><img src="../galleries/transit/otpelevation.png" alt="OpenTripPlanner showing elevation data" /></p>
- <p>One thing I hadn’t tested out last time was OTP’s support for elevation data. It makes use of this by showing the elevation you have to traverse while walking along the suggested route. It can also take it into account when suggesting bike routes.</p>
- <p>The <a href="https://github.com/openplans/OpenTripPlanner/wiki/FiveMinutes">5 minute tutorial</a> actually discusses the elevation data briefly, but a more in-depth thing you can look at is the <a href="https://github.com/openplans/OpenTripPlanner/wiki/GraphBuilder#elevation-data">GraphBuilder documentation</a>. It suggests using the ASTER dataset which is free but requires registration. I just opted to use the SRTM data available from the <a href="http://www.philgis.org/freegisdata.htm">PhilGIS website</a>.</p>
- <p>I don’t know about the ASTER dataset, but the PhilGIS data was in the ERDAS img format. OTP only supports GeoTIFF so there was a need to convert it beforehand. You can use <a href="http://www.gdal.org/">GDAL</a> for this. You’d just then run,</p>
- <div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><code class="language-text" data-lang="text"><span></span>gdal_translate srtm41_90m_phl.img phil.tiff
- </code></pre></div>
- <p>Afterwards, it’s just a matter of following the OTP instructions on using a local elevation dataset. The process actually doubled the size of the generated Graph.obj so it might not be ideal if you’re running on limited RAM.</p>
- <p>I’ve actually hosted a <a href="http://maps.pleasantprogrammer.com">working example</a>. It’s pretty much at the limits of the RAM so it might be slow and unreliable, but you can test it out just for fun. Please don’t abuse it though.</p>
- </div>
- <small class="dateline">Posted: <time class="published dt-published" itemprop="datePublished" datetime="2013-07-23">2013-07-23</time></small>
- | <small class="commentline"><a href="/posts/elevation-data-in-otp.html#isso-thread">Comments</a></small>
- </article>
- </article>
-
- <article class="h-entry post-text" itemscope itemtype="http://schema.org/Blog">
- <header>
- <h1 class="p-name entry-title" itemprop="headline">
- <a href="/posts/graphserver.html" class="u-url">GraphServer</a>
- </h1>
- </header>
- <div class="e-content entry-content">
- <p>Link: <a href="http://graphserver.github.io/graphserver/">http://graphserver.github.io/graphserver/</a></p>
- <p>One other routing webapp I saw was GraphServer. It’s actually more of a general purpose Graph library which supports GTFS and OSM data than an actual dedicated routing software like OpenTripPlanner. It’s also based off python and C instead of Java, so it feels a lot less heavy.</p>
- <p>The instructions on the website are already pretty good. There are just some minor errors with it. Where it says <code>gs_gtfsdb_build</code>, you should actually use <code>gs_gtfsdb_compile</code>. Also, when running <code>gs_osmdb_compile</code> you might need to use <code>-t</code> for tolerant in case you follow the instructions on chopping up the original OSM data.</p>
- <p>A nice suggestion from the GraphServer instructions was to crop the OSM data to minimize the graph size. This is actually quite helpful if you downloaded the entire Philippine OSM dump. It reduced the original 900MB file to 135MB which was a lot more workable. I did hit a problem with their instructions though. The linked version of osmosis is an old one, which doesn’t support 64-bit ids. The <a href="http://wiki.openstreetmap.org/wiki/Osmosis">latest version of Osmosis</a> easily did the job though.</p>
- <p>The actual routing though, was not exactly good. I only tried one route which should normally take 1-2 transfers, it suggested a route which involved 4+ transfers. It also didn’t provide any alternate routes aside from that one. I’m not sure if it’s a limitation of the provided routeserver, but I didn’t bother checking if it supported parameters which might provide better routes.</p>
- <p>I think graphserver could be useful, but it seems more involved than say OpenTripPlanner. There do seem to be people who use graphserver for their routing apps, but for the bounds of the contest, or just as a side project, it might require too much effort.</p>
- </div>
- <small class="dateline">Posted: <time class="published dt-published" itemprop="datePublished" datetime="2013-07-23">2013-07-23</time></small>
- | <small class="commentline"><a href="/posts/graphserver.html#isso-thread">Comments</a></small>
- </article>
- </article>
-
- <article class="h-entry post-text" itemscope itemtype="http://schema.org/Blog">
- <header>
- <h1 class="p-name entry-title" itemprop="headline">
- <a href="/posts/transit-wand.html" class="u-url">Transit Wand</a>
- </h1>
- </header>
- <div class="e-content entry-content">
- <p>Link: <a href="https://play.google.com/store/apps/details?id=com.conveyal.transitwand">http://transitwand.com</a></p>
- <p>Overall, this was the simplest of the <a href="http://philippine-transit.hackathome.com/use-this-code/">open-source transit tools</a> to actually get up and running. There’s already a deployed instance of the server, and you can easily download the phone app via the <a href="https://play.google.com/store/apps/details?id=com.conveyal.transitwand">Play Store</a>. Even running the server by yourself didn’t have any of the hiccups I had with GTFS Editor.</p>
- <p>The phone app is actually quite simple. It allows you to capture a trip, which will record your GPS coordinates as you ride public transit. It also allows you to mark points of the trip where you stop and also how long the stop took. Lastly, it allows you to record embarking and disembarking passengers which is potentially useful for ridership data.</p>
- <p>After doing a capture session, you can review the data on the phone. It will plot out the route on a map, with markers for the stops. You then either delete the data if it looks wrong, or you can upload it to the Transit Wand server. Uploading involves registering an account, but it’s free and you don’t even actually need to put in a username or anything. It simply registers the phone’s IMEI on the server and gives you a 6-digit identifier.</p>
- <p>You can then use the 6-digit identifier to view the data on Transit Wand’s server, which is good since uploading any data automatically deletes it from the phone. There really isn’t much else you can do with it though. It just allows you to view the data, and export it as a <a href="https://en.wikipedia.org/wiki/Shapefile">Shapefile</a>.</p>
- <p>As is, this is purely a data collection client-server app. Barring looking at the database, there is no way to get a list of phones which have collected data. Only the person who initiated the data collection knows the 6-digit code to view their data. There’s also no way to extract the ridership information from the server yet. This isn’t to say that the data won’t eventually go public though.</p>
- <p>An interesting thing you <em>can</em> do with the Transit Wand data is import it into GTFS Editor to make a new route. You don’t even have to manually download and upload the data. Just type in your 6-digit identifier and it will give you a list of routes you’ve captured via Transit Wand. This is wonderful as you get all the stop data, as well as the shape of the route.</p>
- <p>I imagine these two tools were how the DOTC came up with all the GTFS data we have now. What I don’t understand is why the shape data isn’t present. Importing from Transit Wand already gets you shape data. There are even facilities to edit the shape within the editor if clean up is necessary. The only problem I saw was the fact that you can’t easily move stops, you have to input coordinates to change the position.</p>
- <p>It <em>might</em> also be possible that when the DOTC was still collecting the data, the route collection or editing features weren’t present yet. That would just be lame and depressing though.</p>
- <p>Overall, Transit Wand does what it’s supposed to do. You collect data, and then upload it to a server. There is a lot of room for improvement though. It would be nice to have a better API that allows access to more of the data. Building in analysis tools for the ridership data might also be a welcome thing. I imagine it would also be great if you could encourage people to use the app and upload their own trips.</p>
- </div>
- <small class="dateline">Posted: <time class="published dt-published" itemprop="datePublished" datetime="2013-07-15">2013-07-15</time></small>
- | <small class="commentline"><a href="/posts/transit-wand.html#isso-thread">Comments</a></small>
- </article>
- </article>
-
- </div>
- <nav class="postindexpager">
- <ul class="pager clearfix">
-
- <li class="previous">
- <a href="/page/2.html">← Newer posts</a>
- </li>
-
-
- <li class="next">
- <a href="/page/4.html">Older posts →</a>
- </li>
-
- </ul>
- </nav>
- </main>
- <footer id="footer" role="contentinfo">
- <p>
- <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US">
- <img alt="CC-BY-SA" style="border-width:0" src="https://licensebuttons.net/l/by-sa/3.0/80x15.png">
- </a> © 2018 Thomas Dy - Powered by <a href="http://gohugo.io">Hugo</a></p>
- </footer>
- </div>
- <script src="/assets/js/konami.js"></script>
- <script>
- var easter_egg = new Konami();
- easter_egg.code = function() {
- var el = document.getElementById('thomas');
- if(el.className == "whoa") {
- el.className = "";
- }
- else {
- el.className = "whoa";
- }
- document.body.scrollTop = document.documentElement.scrollTop = 0;
- }
- easter_egg.load();
- </script>
- <script
- data-isso="https://isso.pleasantprogrammer.com/"
- src="https://isso.pleasantprogrammer.com/js/count.min.js">
- </script>
- </body>
- </html>
|