title: Google Directions API Encoded Polyline
body: <p>I am trying to map routes which should match the Google Maps street network.</p>
  
  <p>I know how to serialize the JSON result from the Google Maps Directions API.</p>
  
  <p>I am looking now at encoding the polylines from the individual routing steps.</p>
  
  <p>I have found some decoder algorithm here on stackoverflow but tested first Google's own <a href="https://developers.google.com/maps/documentation/utilities/polylineutility" rel="nofollow noreferrer">Interactive Polyline Encoder</a>. I would expect the encoded line to match the Google Map but it doesn't.</p>
  
  <p>The screenshot shows the result of an encoded segment in the Interactive Polyline Encoder on the left and the result from a Google Maps route on the right.</p>
  
  <p><img src="https://i.stack.imgur.com/TKkQo.png" alt="enter image description here"></p>
  
  <p>The encoded polyline is "uxhuBxrc|QPA@?@?B?B@@B@D@HDFD@B@H@JBB@DBFJ"</p>
  
  <p>Is it possible that the Algorithm in Google's Interactive Polyline Encoder is wrong?</p>
  
  <p>Has anyone tested <a href="http://jeffreysambells.com/2010/05/27/decoding-polylines-from-google-maps-direction-api-with-java" rel="nofollow noreferrer">Jeffrey Sambells algorithm</a> and knows whether the results match the results from Google's Interactive decoder?</p>
  
  <p>Cheers,
  Dennis </p>
  
  <p>EDIT: The problem is with the returned polyline segments and not the encoding algorithm. Even the sample segment which Google provides in the example response on the Directions API page fits very poorly with the underlying road geometry.</p>
  
  <p><img src="https://i.stack.imgur.com/NRc76.png" alt="enter image description here"></p>