{"id":227,"date":"2014-09-22T16:26:28","date_gmt":"2014-09-22T21:26:28","guid":{"rendered":"http:\/\/cartometric.com\/blog\/?p=227"},"modified":"2015-01-07T10:48:43","modified_gmt":"2015-01-07T16:48:43","slug":"mysql-implementation-of-google%e2%80%99s-encoded-polyline-algorithm","status":"publish","type":"post","link":"https:\/\/elrobis.com\/blog\/2014\/09\/22\/mysql-implementation-of-google%e2%80%99s-encoded-polyline-algorithm\/","title":{"rendered":"MySQL Implementation of Google\u2019s Encoded Polyline Algorithm"},"content":{"rendered":"<p>I just noticed <a href=\"http:\/\/dogeo.fr\/encoder-un-polygone-avec-lalgo-de-google-dans-mysql\/\" target=\"_blank\">someone created a MySQL implementation of Google&#8217;s Encoded Polyline Algorithm<\/a> incorporating some elements of <a href=\"http:\/\/cartometric.com\/blog\/2014\/01\/27\/postgresql-postgis-implementation-of-google-encoded-polyline-algorithm\/\">my PostgreSQL\/PostGIS approach<\/a>, specifically, support for multi-part, multi-ring polygon geometries.<\/p>\n<p>And this is exciting, at the bottom of his post, Fabien says he&#8217;s working on a solution for consuming the Google encoded geometries in <a href=\"http:\/\/leafletjs.com\/\">Leaflet<\/a>. Nice! I love open source software!<\/p>\n<p>I thought I&#8217;d mention the MySQL approach here to help expose Fabien&#8217;s solution to English searches and drive a little more traffic to his site. If you can&#8217;t read French, <a href=\"https:\/\/translate.google.com\/\">Google Translate<\/a> is your friend!<\/p>\n<p>FWIW&#8211;if anyone is interested and so inclined&#8211;there is a potential improvement that could be made to the Google Encoded Polyline implementation allowing users to specify a desired number of significant digits before rounding the Latitude and Longitude coordinate values prior to encoding. If memory serves, the documentation for Google&#8217;s algorithm allows\/expects only 5 significant digits. But on some datasets with curved line features (often just heavily sampled line-segments), this limitation of 5 significant digits degrades the data, and you end up with jagged line features. So an improved solution would provide an optional parameter to specify significant digits.<\/p>\n<p>All else equal&#8211;nice work, Fabien!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I just noticed someone created a MySQL implementation of Google&#8217;s Encoded Polyline Algorithm incorporating some elements of my PostgreSQL\/PostGIS approach, specifically, support for multi-part, multi-ring polygon geometries. And this is exciting, at the bottom of his post, Fabien says he&#8217;s working on a solution for consuming the Google encoded geometries in Leaflet. Nice! I love [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[27,26,29,23],"tags":[18,5,47,19],"_links":{"self":[{"href":"https:\/\/elrobis.com\/blog\/wp-json\/wp\/v2\/posts\/227"}],"collection":[{"href":"https:\/\/elrobis.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/elrobis.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/elrobis.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/elrobis.com\/blog\/wp-json\/wp\/v2\/comments?post=227"}],"version-history":[{"count":4,"href":"https:\/\/elrobis.com\/blog\/wp-json\/wp\/v2\/posts\/227\/revisions"}],"predecessor-version":[{"id":278,"href":"https:\/\/elrobis.com\/blog\/wp-json\/wp\/v2\/posts\/227\/revisions\/278"}],"wp:attachment":[{"href":"https:\/\/elrobis.com\/blog\/wp-json\/wp\/v2\/media?parent=227"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elrobis.com\/blog\/wp-json\/wp\/v2\/categories?post=227"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elrobis.com\/blog\/wp-json\/wp\/v2\/tags?post=227"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}