elevation-data-in-otp.html 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <!DOCTYPE html><html lang="en">
  2. <head>
  3. <meta name="viewport" content="width=device-width, initial-scale=1">
  4. <meta charset="utf-8">
  5. <meta name="description" content="">
  6. <meta name="author" content="Thomas Dy">
  7. <title>Elevation Data in OTP | Pleasant Programmer</title>
  8. <link href="../assets/css/rst.css" rel="stylesheet" type="text/css">
  9. <link href="../assets/css/code.css" rel="stylesheet" type="text/css">
  10. <link href="../assets/css/colorbox.css" rel="stylesheet" type="text/css">
  11. <link href="../assets/css/theme.css" rel="stylesheet" type="text/css">
  12. <script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script>
  13. <script type="text/javascript">try{Typekit.load();}catch(e){}</script>
  14. <!--[if lt IE 9]>
  15. <script src="http://html5shim.googlecode.com/svn/trunk/html5.js" type="text/javascript"></script>
  16. <![endif]-->
  17. <link rel="alternate" type="application/rss+xml" title="RSS (en)" href="../rss.xml">
  18. </head>
  19. <body>
  20. <header>
  21. <a href="../" title="Pleasant Programmer">
  22. <div class="thomas">
  23. <img src="../assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS">
  24. <img src="../assets/img/thomas.png" alt="Pleasant Programmer">
  25. </div>
  26. <h1 id="blog-title">
  27. Pleasant Programmer
  28. </h1>
  29. </a>
  30. <ul class="nav">
  31. <li class="twitter"><a href="http://twitter.com/pleasantprog">@pleasantprog</a></li>
  32. <li><a href="../archive.html">Archives</a>
  33. </li><li><a href="../categories/index.html">Tags</a>
  34. </li><li><a href="../rss.xml">RSS</a>
  35. </li></ul>
  36. </header>
  37. <div class="container">
  38. <div class="content">
  39. <div class="postbox">
  40. <div class="title">
  41. <h1>Elevation Data in OTP</h1>
  42. <small>
  43. Posted: 2013-07-23 18:23
  44.   |  More posts about
  45. <a class="tag" href="../categories/philippine-transit-app.html"><span class="badge badge-info">philippine-transit-app</span></a>
  46. <a class="tag" href="../categories/programming.html"><span class="badge badge-info">programming</span></a>
  47. </small>
  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. <div class="code"><pre> <span class="n">gdal_translate</span> <span class="n">srtm41_90m_phl</span><span class="p">.</span><span class="n">img</span> <span class="n">phil</span><span class="p">.</span><span class="n">tiff</span>
  54. </pre></div>
  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. <ul class="pager clearfix">
  58. <li class="previous">
  59. <a href="graphserver.html">← Previous post</a>
  60. </li>
  61. <li class="next">
  62. <a href="highways-in-otp.html">Next post →</a>
  63. </li>
  64. </ul>
  65. <div id="disqus_thread"></div>
  66. <script type="text/javascript">
  67. var disqus_shortname ="pleasantprog";
  68. var disqus_url="http://pleasantprogrammer.com/posts/elevation-data-in-otp.html";
  69. var disqus_title="Elevation Data in OTP";
  70. var disqus_identifier="cache/posts/elevation-data-in-otp.html";
  71. var disqus_config = function () {
  72. this.language = "en";
  73. };
  74. (function() {
  75. var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
  76. dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
  77. (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
  78. })();
  79. </script>
  80. <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
  81. </div>
  82. </div>
  83. </div>
  84. <footer>
  85. <small><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> © 2013 Thomas Dy - Powered by <a href="http://nikola.ralsina.com.ar">Nikola</a></small>
  86. <script src="../assets/js/konami.js"></script>
  87. <script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
  88. <script>
  89. var easter_egg = new Konami();
  90. easter_egg.code = function() {
  91. $(".thomas").toggleClass("whoa");
  92. $("body").scrollTop(0);
  93. }
  94. easter_egg.load();
  95. // love you, thomas!
  96. // yours, @_phi + @meggykawsek
  97. </script>
  98. </footer>
  99. <script type="text/javascript">var addthis_config={"ui_language":"en"};</script>
  100. </body>
  101. </html>