geocoding-services.html 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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>Geocoding Services - 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/geocoding-services.html">Geocoding Services</a></h1>
  34. <small>
  35. <span class="dateline">Posted: <time itemprop="datePublished" datetime="2013-09-25">2013-09-25</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>A key component for any routing service is being able to do geocoding. Most people who are looking for routes most probably don&rsquo;t know exactly where their start and end points are on the map. Even then, manually looking for a location on a map is a time-consuming task.</p>
  46. <p>The gold standard for doing geocoding right now is Google Maps. It&rsquo;s hard to find a better location search experience. If they actually provided routing for jeeps here in the Philippines, I imagine there wouldn&rsquo;t be <em>that</em> much you could do for the competition.</p>
  47. <p>When the competition started though, I took it as a challenge to avoid Google Maps as much as possible. I wanted to see how much is currently possible with other options such as OpenStreetMap. In fact, OSM does have a geocoding service called <a href="http://nominatim.openstreetmap.org">Nominatim</a>.</p>
  48. <p>Sadly, for a mapping app, what you want to do is not simply just geocoding. With geocoding, you take an address and turn it into coordinates. When you want to search for a place in a mapping app, you take part of an address, infer the rest of it, and give the user options to choose from.</p>
  49. <p>Given a typical mapping app, you might type in &ldquo;ateneo&rdquo; and expect it to give you Ateneo de Manila University. With typical geocoding services like Nominatim or even Google&rsquo;s <a href="https://developers.google.com/maps/documentation/javascript/geocoding">geocoding API</a>, you probably won&rsquo;t get any result for this. What you want to use is the <a href="https://developers.google.com/maps/documentation/javascript/places">Places API</a> which provides an autocomplete search box. Using it, when you type in &ldquo;ateneo&rdquo;, it automatically suggests in the dropdown, &ldquo;Ateneo de Manila University&rdquo;.</p>
  50. <p>A downside to using the Places API is that it&rsquo;s against the terms of service to use it with something that isn&rsquo;t Google Maps, which means no OpenStreetMap. If there were more time, writing your own autocompletion engine using OpenStreetMap&rsquo;s data will probably be a better long term solution.</p>
  51. <p>For now, since the competition&rsquo;s deadline is just a few days away, I&rsquo;ll be using Google Maps.</p>
  52. </div>
  53. <aside class="postpromonav">
  54. <nav>
  55. <ul class="pager clearfix">
  56. <li class="previous">
  57. <a href="/posts/jeep-and-bus-schedules.html" rel="prev" title="Jeep and Bus Schedules">&larr; Previous post</a>
  58. </li>
  59. <li class="next">
  60. <a href="/posts/console-keymap-switching.html" rel="next" title="Console Keymap Switching">Next post &rarr;</a>
  61. </li>
  62. </ul>
  63. </nav>
  64. </aside>
  65. <section class="comments">
  66. <script
  67. data-isso="https://isso.pleasantprogrammer.com/"
  68. data-isso-require-author="true"
  69. data-isso-vote="false"
  70. src="https://isso.pleasantprogrammer.com/js/embed.min.js">
  71. </script>
  72. <section id="isso-thread"></section>
  73. </section>
  74. </article>
  75. </main>
  76. <footer id="footer" role="contentinfo">
  77. <p>
  78. <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US">
  79. <img alt="CC-BY-SA" style="border-width:0" src="https://licensebuttons.net/l/by-sa/3.0/80x15.png">
  80. </a> &copy; 2022 Thomas Dy - Powered by <a href="http://gohugo.io">Hugo</a></p>
  81. </footer>
  82. </div>
  83. <script src="/assets/js/konami.js"></script>
  84. <script>
  85. var easter_egg = new Konami();
  86. easter_egg.code = function() {
  87. var el = document.getElementById('thomas');
  88. if(el.className == "whoa") {
  89. el.className = "";
  90. }
  91. else {
  92. el.className = "whoa";
  93. }
  94. document.body.scrollTop = document.documentElement.scrollTop = 0;
  95. }
  96. easter_egg.load();
  97. </script>
  98. </body>
  99. </html>