elevation-data-in-otp.html 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <!DOCTYPE html>
  2. <html prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article# " vocab="http://ogp.me/ns" lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width">
  6. <title>Elevation Data in OTP | Pleasant Programmer</title>
  7. <link href="../assets/css/rst.css" rel="stylesheet" type="text/css">
  8. <link href="../assets/css/code.css" rel="stylesheet" type="text/css">
  9. <link href="../assets/css/theme.css" rel="stylesheet" type="text/css">
  10. <link href="../assets/css/custom.css" rel="stylesheet" type="text/css">
  11. <link rel="alternate" type="application/rss+xml" title="RSS" href="../rss.xml">
  12. <link rel="canonical" href="http://pleasantprogrammer.com/posts/elevation-data-in-otp.html">
  13. <script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script><script type="text/javascript">try{Typekit.load();}catch(e){}</script><!--[if lt IE 9]><script src="../assets/js/html5.js"></script><![endif]--><meta name="author" content="Thomas Dy">
  14. <link rel="prev" href="graphserver.html" title="GraphServer" type="text/html">
  15. <link rel="next" href="highways-in-otp.html" title="Highways in OTP" type="text/html">
  16. <meta property="og:site_name" content="Pleasant Programmer">
  17. <meta property="og:title" content="Elevation Data in OTP">
  18. <meta property="og:url" content="http://pleasantprogrammer.com/posts/elevation-data-in-otp.html">
  19. <meta property="og:description" content="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 ta">
  20. <meta property="og:type" content="article">
  21. <meta property="article:published_time" content="2013-07-23T18:23:00+08:00">
  22. <meta property="article:tag" content="philippine-transit-app">
  23. <meta property="article:tag" content="programming">
  24. </head>
  25. <body>
  26. <a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
  27. <header id="header" role="banner"><div class="thomas">
  28. <img src="../assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS"><img src="../assets/img/thomas.png" alt="Pleasant Programmer">
  29. </div>
  30. <h1 id="brand"><a href="http://pleasantprogrammer.com/" title="Pleasant Programmer" rel="home">
  31. <span id="blog-title">Pleasant Programmer</span>
  32. </a></h1>
  33. <nav id="menu" role="navigation"><ul>
  34. <li class="twitter"><a href="http://twitter.com/pleasantprog">@pleasantprog</a></li>
  35. <li><a href="../archive.html">Archives</a></li>
  36. <li><a href="../categories/index.html">Tags</a></li>
  37. <li><a href="../rss.xml">RSS</a></li>
  38. </ul></nav></header><div id="container">
  39. <main id="content" role="main"><article class="post-text h-entry hentry postpage" itemscope="itemscope" itemtype="http://schema.org/Article"><header><h1 class="p-name entry-title" itemprop="headline name"><a href="#" class="u-url">Elevation Data in OTP</a></h1>
  40. <small>
  41. <span class="dateline">Posted: <a href="#" rel="bookmark"><time class="published dt-published" datetime="2013-07-23T18:23:00+08:00" itemprop="datePublished" title="2013-07-23 18:23">2013-07-23 18:23</time></a></span>
  42. |
  43. More posts about
  44. <a class="tag p-category" href="../categories/philippine-transit-app.html" rel="tag">philippine-transit-app</a>
  45. <a class="tag p-category" href="../categories/programming.html" rel="tag">programming</a>
  46. </small>
  47. </header><div class="e-content entry-content" itemprop="articleBody text">
  48. <div>
  49. <p><img alt="OpenTripPlanner showing elevation data" src="../galleries/transit/otpelevation.png"></p>
  50. <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>
  51. <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>
  52. <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>
  53. <pre class="code literal-block"> gdal_translate srtm41_90m_phl.img phil.tiff
  54. </pre>
  55. <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>
  56. <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>
  57. </div>
  58. </div>
  59. <aside class="postpromonav"><nav><ul class="pager clearfix">
  60. <li class="previous">
  61. <a href="graphserver.html" rel="prev" title="GraphServer">← Previous post</a>
  62. </li>
  63. <li class="next">
  64. <a href="highways-in-otp.html" rel="next" title="Highways in OTP">Next post →</a>
  65. </li>
  66. </ul></nav></aside><section class="comments"><div id="disqus_thread"></div>
  67. <script>
  68. var disqus_shortname ="pleasantprog",
  69. disqus_url="http://pleasantprogrammer.com/posts/elevation-data-in-otp.html",
  70. disqus_title="Elevation Data in OTP",
  71. disqus_identifier="cache/posts/elevation-data-in-otp.html",
  72. disqus_config = function () {
  73. this.language = "en";
  74. };
  75. (function() {
  76. var dsq = document.createElement('script'); dsq.async = true;
  77. dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
  78. (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
  79. })();
  80. </script><noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a>
  81. </noscript>
  82. <a href="//disqus.com" class="dsq-brlink" rel="nofollow">Comments powered by <span class="logo-disqus">Disqus</span></a>
  83. </section></article><script>var disqus_shortname="pleasantprog";(function(){var a=document.createElement("script");a.async=true;a.src="//"+disqus_shortname+".disqus.com/count.js";(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(a)}());</script></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="http://i.creativecommons.org/l/by-sa/3.0/80x15.png"></a> © 2015 Thomas Dy - Powered by <a href="http://getnikola.com">Nikola</a></p>
  84. </footer>
  85. </div>
  86. <script src="../assets/js/konami.js"></script><script src="http://code.jquery.com/jquery-2.0.3.min.js"></script><script>
  87. var easter_egg = new Konami();
  88. easter_egg.code = function() {
  89. $(".thomas").toggleClass("whoa");
  90. $("body").scrollTop(0);
  91. }
  92. easter_egg.load();
  93. // love you, thomas!
  94. // yours, @_phi + @meggykawsek
  95. </script>
  96. </body>
  97. </html>