geocoding-services.html 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <!DOCTYPE html>
  2. <html lang="en-us">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="generator" content="Hugo 0.18.1" />
  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 class="twitter">
  23. <a href="http://twitter.com/pleasantprog">@pleasantprog</a>
  24. </li>
  25. <li><a href="/posts.html">archives</a></li>
  26. <li><a href="/tags.html">tags</a></li>
  27. <li><a href="/rss.xml">rss</a></li>
  28. </ul>
  29. </nav>
  30. </header>
  31. <div id="container">
  32. <main id="content" role="main">
  33. <article itemscope itemtype="http://schema.org/BlogPosting">
  34. <h1 class="p-name entry-title" itemprop="headline name">
  35. <a href="/posts/geocoding-services.html">Geocoding Services</a></h1>
  36. <small>
  37. <span class="dateline">Posted: <time itemprop="datePublished" datetime="2013-09-25">2013-09-25</time></span>
  38. | More posts about
  39. <a class="tag p-category" href="/tags/philippine-transit-app.html" rel="tag">
  40. philippine-transit-app
  41. </a>
  42. <a class="tag p-category" href="/tags/programming.html" rel="tag">
  43. programming
  44. </a>
  45. </small>
  46. <div class="e-content entry-content" itemprop="entry-text">
  47. <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>
  48. <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>
  49. <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>
  50. <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>
  51. <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>
  52. <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>
  53. <p>For now, since the competition&rsquo;s deadline is just a few days away, I&rsquo;ll be using Google Maps.</p>
  54. </div>
  55. <aside class="postpromonav">
  56. <nav>
  57. <ul class="pager clearfix">
  58. <li class="previous">
  59. <a href="/posts/jeep-and-bus-schedules.html" rel="prev" title="Jeep and Bus Schedules">&larr; Previous post</a>
  60. </li>
  61. <li class="next">
  62. <a href="/posts/console-keymap-switching.html" rel="next" title="Console Keymap Switching">Next post &rarr;</a>
  63. </li>
  64. </ul>
  65. </nav>
  66. </aside>
  67. <section class="comments">
  68. <div id="disqus_thread"></div>
  69. <script type="text/javascript">
  70. var disqus_shortname = 'pleasantprog';
  71. var disqus_url = 'http:\/\/pleasantprogrammer.com\/posts\/geocoding-services.html';
  72. var disqus_title = 'Geocoding Services';
  73. var disqus_identifier = 'cache/posts/geocoding-services.html';
  74. (function() {
  75. var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
  76. dsq.src = '//' + 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. <a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
  82. </section>
  83. </article>
  84. </main>
  85. <footer id="footer" role="contentinfo">
  86. <p>
  87. <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US">
  88. <img alt="CC-BY-SA" style="border-width:0" src="https://licensebuttons.net/l/by-sa/3.0/80x15.png">
  89. </a> &copy; 2017 Thomas Dy - Powered by <a href="http://gohugo.io">Hugo</a></p>
  90. </footer>
  91. </div>
  92. <script src="/assets/js/konami.js"></script>
  93. <script>
  94. var easter_egg = new Konami();
  95. easter_egg.code = function() {
  96. var el = document.getElementById('thomas');
  97. if(el.className == "whoa") {
  98. el.className = "";
  99. }
  100. else {
  101. el.className = "whoa";
  102. }
  103. document.body.scrollTop = document.documentElement.scrollTop = 0;
  104. }
  105. easter_egg.load();
  106. </script>
  107. </body>
  108. </html>