Browse Source

Highways post

Thomas Dy 11 years ago
parent
commit
6bdbf8ba46

BIN
galleries/transit/otproundabout.png


+ 2 - 1
output/2013/index.html

@@ -36,7 +36,8 @@
         <!--Body content-->
         <div class="postbox">
         <h1>Posts for year 2013</h1>
-        <ul class="unstyled"><li><a href="../posts/elevation-data-in-otp.html">[2013-07-23 18:23] Elevation Data in OTP</a>
+        <ul class="unstyled"><li><a href="../posts/highways-in-otp.html">[2013-07-24 23:15] Highways in OTP</a>
+            </li><li><a href="../posts/elevation-data-in-otp.html">[2013-07-23 18:23] Elevation Data in OTP</a>
             </li><li><a href="../posts/graphserver.html">[2013-07-23 14:48] GraphServer</a>
             </li><li><a href="../posts/transit-wand.html">[2013-07-15 22:45] Transit Wand</a>
             </li><li><a href="../posts/fare-data.html">[2013-07-13 21:15] Fare Data</a>

+ 1 - 1
output/assets/js/tag_cloud_data.json

@@ -1 +1 @@
-{"programming": [9, "/categories/programming.html"], "lets-debug": [1, "/categories/lets-debug.html"], "philippine-transit-app": [9, "/categories/philippine-transit-app.html"]}
+{"programming": [10, "/categories/programming.html"], "lets-debug": [1, "/categories/lets-debug.html"], "philippine-transit-app": [10, "/categories/philippine-transit-app.html"]}

+ 1 - 1
output/categories/lets-debug.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<rss version="2.0"><channel><title>Pleasant Programmer (lets-debug)</title><link>http://pleasantprogrammer.com</link><description></description><lastBuildDate>Tue, 23 Jul 2013 18:24:35 GMT</lastBuildDate><generator>nikola</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>GTFS Editor</title><link>http://pleasantprogrammer.com/posts/gtfs-editor.html</link><description>&lt;html&gt;&lt;body&gt;&lt;p&gt;Link: &lt;a href="https://github.com/conveyal/gtfs-editor"&gt;https://github.com/conveyal/gtfs-editor&lt;/a&gt;&lt;/p&gt;
+<rss version="2.0"><channel><title>Pleasant Programmer (lets-debug)</title><link>http://pleasantprogrammer.com</link><description></description><lastBuildDate>Wed, 24 Jul 2013 23:54:41 GMT</lastBuildDate><generator>nikola</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>GTFS Editor</title><link>http://pleasantprogrammer.com/posts/gtfs-editor.html</link><description>&lt;html&gt;&lt;body&gt;&lt;p&gt;Link: &lt;a href="https://github.com/conveyal/gtfs-editor"&gt;https://github.com/conveyal/gtfs-editor&lt;/a&gt;&lt;/p&gt;
 &lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt; they really meant under development&lt;/p&gt;
 &lt;p&gt;When I first saw the source of GTFS Editor, I was ecstatic. They used &lt;a href="http://playframework.com/"&gt;Play framework&lt;/a&gt;!!! Not only that, they're targeting PostgreSQL as the main database. Those are our favorite tools for building webapps at By Implication. I was a bit sad though, when I saw it was on the 1.x release of Play though. I did have some experience with that release, but not as much compared to 2.x.&lt;/p&gt;
 &lt;p&gt;Getting it to actually run though, wasn't very pleasant. The initial setup was easy enough. Get &lt;a href="http://www.playframework.com/download"&gt;Play 1.2.5&lt;/a&gt;, install Postgres with PostGIS, clone the repo and create backing database in Postgres. Some minor additional steps you need are to create the PostGIS extension on the database. The schema is automatically generated and applied by Play so that should be all that's necessary. Wonderful. Then, run play, open a browser, go to &lt;a href="http://localhost:9000"&gt;http://localhost:9000&lt;/a&gt;, compilation error. Fantastic.&lt;/p&gt;

+ 2 - 1
output/categories/philippine-transit-app.html

@@ -37,7 +37,8 @@
         <div class="postbox">
         <h1>Posts about philippine-transit-app</h1>
             <a href="philippine-transit-app.xml">RSS</a>
-        <br><ul class="unstyled"><li><a href="../posts/elevation-data-in-otp.html">[2013-07-23 18:23] Elevation Data in OTP</a>
+        <br><ul class="unstyled"><li><a href="../posts/highways-in-otp.html">[2013-07-24 23:15] Highways in OTP</a>
+            </li><li><a href="../posts/elevation-data-in-otp.html">[2013-07-23 18:23] Elevation Data in OTP</a>
             </li><li><a href="../posts/graphserver.html">[2013-07-23 14:48] GraphServer</a>
             </li><li><a href="../posts/transit-wand.html">[2013-07-15 22:45] Transit Wand</a>
             </li><li><a href="../posts/fare-data.html">[2013-07-13 21:15] Fare Data</a>

+ 12 - 1
output/categories/philippine-transit-app.xml

@@ -1,5 +1,16 @@
 <?xml version="1.0" encoding="utf-8"?>
-<rss version="2.0"><channel><title>Pleasant Programmer (philippine-transit-app)</title><link>http://pleasantprogrammer.com</link><description></description><lastBuildDate>Tue, 23 Jul 2013 18:24:35 GMT</lastBuildDate><generator>nikola</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Elevation Data in OTP</title><link>http://pleasantprogrammer.com/posts/elevation-data-in-otp.html</link><description>&lt;html&gt;&lt;body&gt;&lt;p&gt;&lt;img alt="OpenTripPlanner showing elevation data" src="/galleries/transit/otpelevation.png"&gt;&lt;/p&gt;
+<rss version="2.0"><channel><title>Pleasant Programmer (philippine-transit-app)</title><link>http://pleasantprogrammer.com</link><description></description><lastBuildDate>Wed, 24 Jul 2013 23:54:41 GMT</lastBuildDate><generator>nikola</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Highways in OTP</title><link>http://pleasantprogrammer.com/posts/highways-in-otp.html</link><description>&lt;html&gt;&lt;body&gt;&lt;p&gt;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:&lt;/p&gt;
+&lt;p&gt;&lt;img alt="Roundabout route from UP to Ateneo" src="/galleries/transit/otproundabout.png"&gt;&lt;/p&gt;
+&lt;p&gt;This is just so hilariously wrong. It's much simpler to just walk along Katipunan Avenue.&lt;/p&gt;
+&lt;p&gt;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.&lt;/p&gt;
+&lt;p&gt;Apparently, by default OTP will consider roads of type &lt;code&gt;trunk&lt;/code&gt; to be non-walkable and non-bikable. This is documented in the &lt;a href="http://wiki.openstreetmap.org/wiki/OpenTripPlanner"&gt;OpenStreetMap wiki&lt;/a&gt; and the &lt;a href="https://github.com/openplans/OpenTripPlanner/wiki/GraphBuilder#permissions-and-bicycle-safety"&gt;OTP wiki&lt;/a&gt; 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.&lt;/p&gt;
+&lt;div class="code"&gt;&lt;pre&gt;&lt;span class="n"&gt;sed&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;bak&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;trunk&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;primary&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt; &lt;span class="n"&gt;manila&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;osm&lt;/span&gt;
+&lt;/pre&gt;&lt;/div&gt;
+
+
+&lt;p&gt;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 &lt;a href="http://maps.pleasantprogrammer.com"&gt;maps.pleasantprogrammer.com&lt;/a&gt;.&lt;/p&gt;
+&lt;p&gt;It's also possible to set the default way properties in OTP. Instead of disallowing walking and biking on &lt;code&gt;highway=trunk&lt;/code&gt; we could allow that. This is not much better than the &lt;code&gt;sed&lt;/code&gt; 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.&lt;/p&gt;
+&lt;p&gt;The most correct way to actually fix this is to go through each of the trunks and specifying &lt;code&gt;foot=yes&lt;/code&gt; and &lt;code&gt;bicycle=yes&lt;/code&gt; 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.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</description><guid>http://pleasantprogrammer.com/posts/highways-in-otp.html</guid><pubDate>Wed, 24 Jul 2013 15:15:57 GMT</pubDate></item><item><title>Elevation Data in OTP</title><link>http://pleasantprogrammer.com/posts/elevation-data-in-otp.html</link><description>&lt;html&gt;&lt;body&gt;&lt;p&gt;&lt;img alt="OpenTripPlanner showing elevation data" src="/galleries/transit/otpelevation.png"&gt;&lt;/p&gt;
 &lt;p&gt;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.&lt;/p&gt;
 &lt;p&gt;The &lt;a href="https://github.com/openplans/OpenTripPlanner/wiki/FiveMinutes"&gt;5 minute tutorial&lt;/a&gt; actually discusses the elevation data briefly, but a more in-depth thing you can look at is the &lt;a href="https://github.com/openplans/OpenTripPlanner/wiki/GraphBuilder#elevation-data"&gt;GraphBuilder documentation&lt;/a&gt;. It suggests using the ASTER dataset which is free but requires registration. I just opted to use the SRTM data available from the &lt;a href="http://www.philgis.org/freegisdata.htm"&gt;PhilGIS website&lt;/a&gt;.&lt;/p&gt;
 &lt;p&gt;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 &lt;a href="http://www.gdal.org/"&gt;GDAL&lt;/a&gt; for this. You'd just then run,&lt;/p&gt;

+ 2 - 1
output/categories/programming.html

@@ -37,7 +37,8 @@
         <div class="postbox">
         <h1>Posts about programming</h1>
             <a href="programming.xml">RSS</a>
-        <br><ul class="unstyled"><li><a href="../posts/elevation-data-in-otp.html">[2013-07-23 18:23] Elevation Data in OTP</a>
+        <br><ul class="unstyled"><li><a href="../posts/highways-in-otp.html">[2013-07-24 23:15] Highways in OTP</a>
+            </li><li><a href="../posts/elevation-data-in-otp.html">[2013-07-23 18:23] Elevation Data in OTP</a>
             </li><li><a href="../posts/graphserver.html">[2013-07-23 14:48] GraphServer</a>
             </li><li><a href="../posts/transit-wand.html">[2013-07-15 22:45] Transit Wand</a>
             </li><li><a href="../posts/fare-data.html">[2013-07-13 21:15] Fare Data</a>

+ 12 - 1
output/categories/programming.xml

@@ -1,5 +1,16 @@
 <?xml version="1.0" encoding="utf-8"?>
-<rss version="2.0"><channel><title>Pleasant Programmer (programming)</title><link>http://pleasantprogrammer.com</link><description></description><lastBuildDate>Tue, 23 Jul 2013 18:24:35 GMT</lastBuildDate><generator>nikola</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Elevation Data in OTP</title><link>http://pleasantprogrammer.com/posts/elevation-data-in-otp.html</link><description>&lt;html&gt;&lt;body&gt;&lt;p&gt;&lt;img alt="OpenTripPlanner showing elevation data" src="/galleries/transit/otpelevation.png"&gt;&lt;/p&gt;
+<rss version="2.0"><channel><title>Pleasant Programmer (programming)</title><link>http://pleasantprogrammer.com</link><description></description><lastBuildDate>Wed, 24 Jul 2013 23:54:41 GMT</lastBuildDate><generator>nikola</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Highways in OTP</title><link>http://pleasantprogrammer.com/posts/highways-in-otp.html</link><description>&lt;html&gt;&lt;body&gt;&lt;p&gt;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:&lt;/p&gt;
+&lt;p&gt;&lt;img alt="Roundabout route from UP to Ateneo" src="/galleries/transit/otproundabout.png"&gt;&lt;/p&gt;
+&lt;p&gt;This is just so hilariously wrong. It's much simpler to just walk along Katipunan Avenue.&lt;/p&gt;
+&lt;p&gt;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.&lt;/p&gt;
+&lt;p&gt;Apparently, by default OTP will consider roads of type &lt;code&gt;trunk&lt;/code&gt; to be non-walkable and non-bikable. This is documented in the &lt;a href="http://wiki.openstreetmap.org/wiki/OpenTripPlanner"&gt;OpenStreetMap wiki&lt;/a&gt; and the &lt;a href="https://github.com/openplans/OpenTripPlanner/wiki/GraphBuilder#permissions-and-bicycle-safety"&gt;OTP wiki&lt;/a&gt; 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.&lt;/p&gt;
+&lt;div class="code"&gt;&lt;pre&gt;&lt;span class="n"&gt;sed&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;bak&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;trunk&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;primary&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt; &lt;span class="n"&gt;manila&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;osm&lt;/span&gt;
+&lt;/pre&gt;&lt;/div&gt;
+
+
+&lt;p&gt;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 &lt;a href="http://maps.pleasantprogrammer.com"&gt;maps.pleasantprogrammer.com&lt;/a&gt;.&lt;/p&gt;
+&lt;p&gt;It's also possible to set the default way properties in OTP. Instead of disallowing walking and biking on &lt;code&gt;highway=trunk&lt;/code&gt; we could allow that. This is not much better than the &lt;code&gt;sed&lt;/code&gt; 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.&lt;/p&gt;
+&lt;p&gt;The most correct way to actually fix this is to go through each of the trunks and specifying &lt;code&gt;foot=yes&lt;/code&gt; and &lt;code&gt;bicycle=yes&lt;/code&gt; 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.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</description><guid>http://pleasantprogrammer.com/posts/highways-in-otp.html</guid><pubDate>Wed, 24 Jul 2013 15:15:57 GMT</pubDate></item><item><title>Elevation Data in OTP</title><link>http://pleasantprogrammer.com/posts/elevation-data-in-otp.html</link><description>&lt;html&gt;&lt;body&gt;&lt;p&gt;&lt;img alt="OpenTripPlanner showing elevation data" src="/galleries/transit/otpelevation.png"&gt;&lt;/p&gt;
 &lt;p&gt;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.&lt;/p&gt;
 &lt;p&gt;The &lt;a href="https://github.com/openplans/OpenTripPlanner/wiki/FiveMinutes"&gt;5 minute tutorial&lt;/a&gt; actually discusses the elevation data briefly, but a more in-depth thing you can look at is the &lt;a href="https://github.com/openplans/OpenTripPlanner/wiki/GraphBuilder#elevation-data"&gt;GraphBuilder documentation&lt;/a&gt;. It suggests using the ASTER dataset which is free but requires registration. I just opted to use the SRTM data available from the &lt;a href="http://www.philgis.org/freegisdata.htm"&gt;PhilGIS website&lt;/a&gt;.&lt;/p&gt;
 &lt;p&gt;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 &lt;a href="http://www.gdal.org/"&gt;GDAL&lt;/a&gt; for this. You'd just then run,&lt;/p&gt;

+ 2 - 0
output/galleries/transit/index.html

@@ -51,6 +51,8 @@
                 <img src="otp2.thumbnail.png"></a>
             </li><li><a href="otpelevation.png" class="thumbnail image-reference" id="otpelevation" alt="otpelevation" title="Otpelevation">
                 <img src="otpelevation.thumbnail.png"></a>
+            </li><li><a href="otproundabout.png" class="thumbnail image-reference" id="otproundabout" alt="otproundabout" title="Otproundabout">
+                <img src="otproundabout.thumbnail.png"></a>
     </li></ul></div>
     </div>
     <!--End of body content-->

BIN
output/galleries/transit/otproundabout.png


BIN
output/galleries/transit/otproundabout.thumbnail.png


+ 21 - 0
output/index.html

@@ -33,6 +33,27 @@
     <div class="span2"></div>
     <div class="span8">
     
+        <div class="postbox">
+        <h1><a href="posts/highways-in-otp.html">Highways in OTP</a>
+        <small>  
+             Posted: <time class="published" datetime="2013-07-24T23:15:57+08:00">2013-07-24 23:15</time></small></h1>
+        <hr><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 alt="Roundabout route from UP to Ateneo" src="galleries/transit/otproundabout.png"></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="code"><pre><span class="n">sed</span> <span class="o">-</span><span class="n">i</span> <span class="p">.</span><span class="n">bak</span> <span class="n">s</span><span class="o">/</span><span class="n">trunk</span><span class="o">/</span><span class="n">primary</span><span class="o">/</span><span class="n">g</span> <span class="n">manila</span><span class="p">.</span><span class="n">osm</span>
+</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>
+            
+    <p>
+        <a href="posts/highways-in-otp.html#disqus_thread" data-disqus-identifier="cache/posts/highways-in-otp.html">Comments</a>
+
+        </p></div>
         <div class="postbox">
         <h1><a href="posts/elevation-data-in-otp.html">Elevation Data in OTP</a>
         <small>  

+ 3 - 0
output/posts/elevation-data-in-otp.html

@@ -65,6 +65,9 @@
     <ul class="pager"><li class="previous">
             <a href="graphserver.html">← Previous post</a>
         </li>
+        <li class="next">
+            <a href="highways-in-otp.html">Next post →</a>
+        </li>
     </ul><div id="disqus_thread"></div>
         <script type="text/javascript">
         var disqus_shortname ="pleasantprog";

+ 100 - 0
output/posts/highways-in-otp.html

@@ -0,0 +1,100 @@
+<!DOCTYPE html><html lang="en"><head><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta charset="utf-8"><meta name="description" content=""><meta name="author" content="Thomas Dy"><title>Highways in OTP | Pleasant Programmer</title><link href="../assets/css/bootstrap.min.css" rel="stylesheet" type="text/css"><link href="../assets/css/bootstrap-responsive.min.css" rel="stylesheet" type="text/css"><link href="../assets/css/rst.css" rel="stylesheet" type="text/css"><link href="../assets/css/code.css" rel="stylesheet" type="text/css"><link href="../assets/css/colorbox.css" rel="stylesheet" type="text/css"><link href="../assets/css/theme.css" rel="stylesheet" type="text/css"><link href="../assets/css/custom.css" rel="stylesheet" type="text/css"><!--[if lt IE 9]>
+      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js" type="text/javascript"></script>
+    <![endif]--><link rel="alternate" type="application/rss+xml" title="RSS" href="../rss.xml"></head><body>
+<!-- Menubar -->
+<div class="navbar navbar-fixed-top">
+    <div class="navbar-inner">
+        <div class="container">
+
+        <!-- .btn-navbar is used as the toggle for collapsed navbar content -->
+        <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
+            <span class="icon-bar"></span>
+            <span class="icon-bar"></span>
+            <span class="icon-bar"></span>
+        </a>
+
+            <a class="brand" href="../">
+            Pleasant Programmer
+            </a>
+            <!-- Everything you want hidden at 940px or less, place within here -->
+            <div class="nav-collapse collapse">
+                <ul class="nav"><li><a href="../archive.html">Archives</a>
+            </li><li><a href="../categories/index.html">Tags</a>
+            </li><li><a href="../rss.xml">RSS</a>
+
+                </li></ul><ul class="nav pull-right"><li>
+    <a href="highways-in-otp.md" id="sourcelink">Source</a>
+    </li>
+
+                </ul></div>
+        </div>
+    </div>
+</div>
+<!-- End of Menubar -->
+<div class="container-fluid" id="container-fluid">
+    <!--Body content-->
+    <div class="row-fluid">
+    <div class="span2"></div>
+    <div class="span8">
+    
+    <div class="postbox">
+    
+    <h1>Highways in OTP</h1>
+
+    <hr><small>
+        Posted: <time class="published" datetime="2013-07-24T23:15:57+08:00">2013-07-24 23:15</time>
+        
+
+        
+          |  More posts about
+            <a class="tag" href="../categories/philippine-transit-app.html"><span class="badge badge-info">philippine-transit-app</span></a>
+            <a class="tag" href="../categories/programming.html"><span class="badge badge-info">programming</span></a>
+
+    </small>
+    <hr><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 alt="Roundabout route from UP to Ateneo" src="../galleries/transit/otproundabout.png"></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="code"><pre><span class="n">sed</span> <span class="o">-</span><span class="n">i</span> <span class="p">.</span><span class="n">bak</span> <span class="n">s</span><span class="o">/</span><span class="n">trunk</span><span class="o">/</span><span class="n">primary</span><span class="o">/</span><span class="n">g</span> <span class="n">manila</span><span class="p">.</span><span class="n">osm</span>
+</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>
+    
+    <ul class="pager"><li class="previous">
+            <a href="elevation-data-in-otp.html">← Previous post</a>
+        </li>
+    </ul><div id="disqus_thread"></div>
+        <script type="text/javascript">
+        var disqus_shortname ="pleasantprog";
+            var disqus_url="http://pleasantprogrammer.com/posts/highways-in-otp.html";
+        var disqus_title="Highways in OTP";
+        var disqus_identifier="cache/posts/highways-in-otp.html";
+        var disqus_config = function () {
+            this.language = "en";
+        };
+        (function() {
+            var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
+            dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
+            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
+        })();
+    </script><noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
+
+    
+
+    </div>
+
+    </div>
+    </div>
+    <!--End of body content-->
+</div>
+<div class="footerbox">
+    <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png"></a> © 2013 Thomas Dy - Powered by <a href="http://nikola.ralsina.com.ar">Nikola</a>
+</div>
+
+
+
+            <script src="../assets/js/jquery-1.7.2.min.js" type="text/javascript"></script><script src="../assets/js/bootstrap.min.js" type="text/javascript"></script><script src="../assets/js/jquery.colorbox-min.js" type="text/javascript"></script><script type="text/javascript">jQuery("a.image-reference").colorbox({rel:"gal",maxWidth:"80%",maxHeight:"80%",scalePhotos:true});</script></body></html>

+ 26 - 0
output/posts/highways-in-otp.md

@@ -0,0 +1,26 @@
+<!-- 
+.. link: 
+.. description: 
+.. tags: philippine-transit-app, programming
+.. date: 2013/07/24 23:15:57
+.. title: Highways in OTP
+.. slug: highways-in-otp
+-->
+
+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:
+
+![Roundabout route from UP to Ateneo](../galleries/transit/otproundabout.png)
+
+This is just so hilariously wrong. It's much simpler to just walk along Katipunan Avenue.
+
+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.
+
+Apparently, by default OTP will consider roads of type `trunk` to be non-walkable and non-bikable. This is documented in the [OpenStreetMap wiki](http://wiki.openstreetmap.org/wiki/OpenTripPlanner) and the [OTP wiki](https://github.com/openplans/OpenTripPlanner/wiki/GraphBuilder#permissions-and-bicycle-safety) 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.
+
+    sed -i .bak s/trunk/primary/g manila.osm
+
+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 [maps.pleasantprogrammer.com](http://maps.pleasantprogrammer.com).
+
+It's also possible to set the default way properties in OTP. Instead of disallowing walking and biking on `highway=trunk` we could allow that. This is not much better than the `sed` 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.
+
+The most correct way to actually fix this is to go through each of the trunks and specifying `foot=yes` and `bicycle=yes` 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.

+ 12 - 1
output/rss.xml

@@ -1,5 +1,16 @@
 <?xml version="1.0" encoding="utf-8"?>
-<rss version="2.0"><channel><title>Pleasant Programmer</title><link>http://pleasantprogrammer.com</link><description></description><lastBuildDate>Tue, 23 Jul 2013 18:24:35 GMT</lastBuildDate><generator>nikola</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Elevation Data in OTP</title><link>http://pleasantprogrammer.com/posts/elevation-data-in-otp.html</link><description>&lt;html&gt;&lt;body&gt;&lt;p&gt;&lt;img alt="OpenTripPlanner showing elevation data" src="/galleries/transit/otpelevation.png"&gt;&lt;/p&gt;
+<rss version="2.0"><channel><title>Pleasant Programmer</title><link>http://pleasantprogrammer.com</link><description></description><lastBuildDate>Wed, 24 Jul 2013 23:54:41 GMT</lastBuildDate><generator>nikola</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Highways in OTP</title><link>http://pleasantprogrammer.com/posts/highways-in-otp.html</link><description>&lt;html&gt;&lt;body&gt;&lt;p&gt;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:&lt;/p&gt;
+&lt;p&gt;&lt;img alt="Roundabout route from UP to Ateneo" src="/galleries/transit/otproundabout.png"&gt;&lt;/p&gt;
+&lt;p&gt;This is just so hilariously wrong. It's much simpler to just walk along Katipunan Avenue.&lt;/p&gt;
+&lt;p&gt;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.&lt;/p&gt;
+&lt;p&gt;Apparently, by default OTP will consider roads of type &lt;code&gt;trunk&lt;/code&gt; to be non-walkable and non-bikable. This is documented in the &lt;a href="http://wiki.openstreetmap.org/wiki/OpenTripPlanner"&gt;OpenStreetMap wiki&lt;/a&gt; and the &lt;a href="https://github.com/openplans/OpenTripPlanner/wiki/GraphBuilder#permissions-and-bicycle-safety"&gt;OTP wiki&lt;/a&gt; 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.&lt;/p&gt;
+&lt;div class="code"&gt;&lt;pre&gt;&lt;span class="n"&gt;sed&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;bak&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;trunk&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;primary&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt; &lt;span class="n"&gt;manila&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;osm&lt;/span&gt;
+&lt;/pre&gt;&lt;/div&gt;
+
+
+&lt;p&gt;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 &lt;a href="http://maps.pleasantprogrammer.com"&gt;maps.pleasantprogrammer.com&lt;/a&gt;.&lt;/p&gt;
+&lt;p&gt;It's also possible to set the default way properties in OTP. Instead of disallowing walking and biking on &lt;code&gt;highway=trunk&lt;/code&gt; we could allow that. This is not much better than the &lt;code&gt;sed&lt;/code&gt; 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.&lt;/p&gt;
+&lt;p&gt;The most correct way to actually fix this is to go through each of the trunks and specifying &lt;code&gt;foot=yes&lt;/code&gt; and &lt;code&gt;bicycle=yes&lt;/code&gt; 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.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</description><guid>http://pleasantprogrammer.com/posts/highways-in-otp.html</guid><pubDate>Wed, 24 Jul 2013 15:15:57 GMT</pubDate></item><item><title>Elevation Data in OTP</title><link>http://pleasantprogrammer.com/posts/elevation-data-in-otp.html</link><description>&lt;html&gt;&lt;body&gt;&lt;p&gt;&lt;img alt="OpenTripPlanner showing elevation data" src="/galleries/transit/otpelevation.png"&gt;&lt;/p&gt;
 &lt;p&gt;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.&lt;/p&gt;
 &lt;p&gt;The &lt;a href="https://github.com/openplans/OpenTripPlanner/wiki/FiveMinutes"&gt;5 minute tutorial&lt;/a&gt; actually discusses the elevation data briefly, but a more in-depth thing you can look at is the &lt;a href="https://github.com/openplans/OpenTripPlanner/wiki/GraphBuilder#elevation-data"&gt;GraphBuilder documentation&lt;/a&gt;. It suggests using the ASTER dataset which is free but requires registration. I just opted to use the SRTM data available from the &lt;a href="http://www.philgis.org/freegisdata.htm"&gt;PhilGIS website&lt;/a&gt;.&lt;/p&gt;
 &lt;p&gt;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 &lt;a href="http://www.gdal.org/"&gt;GDAL&lt;/a&gt; for this. You'd just then run,&lt;/p&gt;

+ 23 - 23
output/sitemap.xml

@@ -6,117 +6,117 @@
                         http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
  <url>
   <loc>http://pleasantprogrammer.com</loc>
-  <lastmod>2013-07-23</lastmod>
+  <lastmod>2013-07-24</lastmod>
   <priority>0.5000</priority>
  </url>
  <url>
   <loc>http://pleasantprogrammer.com/2013/</loc>
-  <lastmod>2013-07-23</lastmod>
+  <lastmod>2013-07-24</lastmod>
   <priority>0.5000</priority>
  </url>
  <url>
   <loc>http://pleasantprogrammer.com/2013/index.html</loc>
-  <lastmod>2013-07-23</lastmod>
+  <lastmod>2013-07-24</lastmod>
   <priority>0.5000</priority>
  </url>
  <url>
   <loc>http://pleasantprogrammer.com/archive.html</loc>
-  <lastmod>2013-07-23</lastmod>
+  <lastmod>2013-07-24</lastmod>
   <priority>0.5000</priority>
  </url>
  <url>
   <loc>http://pleasantprogrammer.com/assets/</loc>
-  <lastmod>2013-07-23</lastmod>
+  <lastmod>2013-07-24</lastmod>
   <priority>0.5000</priority>
  </url>
  <url>
   <loc>http://pleasantprogrammer.com/assets/css/</loc>
-  <lastmod>2013-07-23</lastmod>
+  <lastmod>2013-07-24</lastmod>
   <priority>0.5000</priority>
  </url>
  <url>
   <loc>http://pleasantprogrammer.com/assets/css/images/</loc>
-  <lastmod>2013-07-23</lastmod>
+  <lastmod>2013-07-24</lastmod>
   <priority>0.5000</priority>
  </url>
  <url>
   <loc>http://pleasantprogrammer.com/assets/css/images/ie6/</loc>
-  <lastmod>2013-07-23</lastmod>
+  <lastmod>2013-07-24</lastmod>
   <priority>0.5000</priority>
  </url>
  <url>
   <loc>http://pleasantprogrammer.com/assets/img/</loc>
-  <lastmod>2013-07-23</lastmod>
+  <lastmod>2013-07-24</lastmod>
   <priority>0.5000</priority>
  </url>
  <url>
   <loc>http://pleasantprogrammer.com/assets/js/</loc>
-  <lastmod>2013-07-23</lastmod>
+  <lastmod>2013-07-24</lastmod>
   <priority>0.5000</priority>
  </url>
  <url>
   <loc>http://pleasantprogrammer.com/categories/</loc>
-  <lastmod>2013-07-23</lastmod>
+  <lastmod>2013-07-24</lastmod>
   <priority>0.5000</priority>
  </url>
  <url>
   <loc>http://pleasantprogrammer.com/categories/index.html</loc>
-  <lastmod>2013-07-23</lastmod>
+  <lastmod>2013-07-24</lastmod>
   <priority>0.5000</priority>
  </url>
  <url>
   <loc>http://pleasantprogrammer.com/categories/lets-debug.html</loc>
-  <lastmod>2013-07-23</lastmod>
+  <lastmod>2013-07-24</lastmod>
   <priority>0.5000</priority>
  </url>
  <url>
   <loc>http://pleasantprogrammer.com/categories/philippine-transit-app.html</loc>
-  <lastmod>2013-07-23</lastmod>
+  <lastmod>2013-07-24</lastmod>
   <priority>0.5000</priority>
  </url>
  <url>
   <loc>http://pleasantprogrammer.com/categories/programming.html</loc>
-  <lastmod>2013-07-23</lastmod>
+  <lastmod>2013-07-24</lastmod>
   <priority>0.5000</priority>
  </url>
  <url>
   <loc>http://pleasantprogrammer.com/galleries/</loc>
-  <lastmod>2013-07-23</lastmod>
+  <lastmod>2013-07-24</lastmod>
   <priority>0.5000</priority>
  </url>
  <url>
   <loc>http://pleasantprogrammer.com/galleries/index.html</loc>
-  <lastmod>2013-07-23</lastmod>
+  <lastmod>2013-07-24</lastmod>
   <priority>0.5000</priority>
  </url>
  <url>
   <loc>http://pleasantprogrammer.com/galleries/transit/</loc>
-  <lastmod>2013-07-23</lastmod>
+  <lastmod>2013-07-24</lastmod>
   <priority>0.5000</priority>
  </url>
  <url>
   <loc>http://pleasantprogrammer.com/galleries/transit/index.html</loc>
-  <lastmod>2013-07-23</lastmod>
+  <lastmod>2013-07-24</lastmod>
   <priority>0.5000</priority>
  </url>
  <url>
   <loc>http://pleasantprogrammer.com/listings/</loc>
-  <lastmod>2013-07-23</lastmod>
+  <lastmod>2013-07-24</lastmod>
   <priority>0.5000</priority>
  </url>
  <url>
   <loc>http://pleasantprogrammer.com/listings/index.html</loc>
-  <lastmod>2013-07-23</lastmod>
+  <lastmod>2013-07-24</lastmod>
   <priority>0.5000</priority>
  </url>
  <url>
   <loc>http://pleasantprogrammer.com/posts/</loc>
-  <lastmod>2013-07-23</lastmod>
+  <lastmod>2013-07-24</lastmod>
   <priority>0.5000</priority>
  </url>
  <url>
   <loc>http://pleasantprogrammer.com/uploads/</loc>
-  <lastmod>2013-07-23</lastmod>
+  <lastmod>2013-07-24</lastmod>
   <priority>0.5000</priority>
  </url>
 </urlset>

+ 26 - 0
posts/highways-in-otp.md

@@ -0,0 +1,26 @@
+<!-- 
+.. link: 
+.. description: 
+.. tags: philippine-transit-app, programming
+.. date: 2013/07/24 23:15:57
+.. title: Highways in OTP
+.. slug: highways-in-otp
+-->
+
+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:
+
+![Roundabout route from UP to Ateneo](../galleries/transit/otproundabout.png)
+
+This is just so hilariously wrong. It's much simpler to just walk along Katipunan Avenue.
+
+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.
+
+Apparently, by default OTP will consider roads of type `trunk` to be non-walkable and non-bikable. This is documented in the [OpenStreetMap wiki](http://wiki.openstreetmap.org/wiki/OpenTripPlanner) and the [OTP wiki](https://github.com/openplans/OpenTripPlanner/wiki/GraphBuilder#permissions-and-bicycle-safety) 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.
+
+    sed -i .bak s/trunk/primary/g manila.osm
+
+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 [maps.pleasantprogrammer.com](http://maps.pleasantprogrammer.com).
+
+It's also possible to set the default way properties in OTP. Instead of disallowing walking and biking on `highway=trunk` we could allow that. This is not much better than the `sed` 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.
+
+The most correct way to actually fix this is to go through each of the trunks and specifying `foot=yes` and `bicycle=yes` 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.