title: Fetching all the coordinates along a route generated by Directions Service in Google Maps Apiv3
body: <p>My application allows a user to select two points on the map and find a route between them using the Directions Service of the Google maps Apiv3. Then the coordinates along this route has to be saved to the database. I could successfully write all the code to accomplish this. However I am left out with an issue.</p>
  
  <p>I know that there are several other questions in StackOverflow- <a href="https://stackoverflow.com/questions/6152160/how-to-get-the-list-of-waypoints-of-a-route-displayed-on-the-google-maps-throug">One</a>, <a href="https://stackoverflow.com/questions/9014830/how-do-i-get-google-map-v3-direction-coordinates-from-start-to-end">Two</a> on the same, but I think surely either they or me has missed out something here.</p>
  
  <p>Sample Code:</p>
  
  <pre><code>function getCoordinates(result) {
              var currentRouteArray = result.routes[0];  //Returns a complex object containing the results of the current route
              var currentRoute = currentRouteArray.overview_path; //Returns a simplified version of all the coordinates on the path
  
  
              obj_newPolyline = new google.maps.Polyline({ map: map }); //a polyline just to verify my code is fetching the coordinates
              var path = obj_newPolyline.getPath();
              for (var x = 0; x &lt; currentRoute.length; x++) {
                  var pos = new google.maps.LatLng(currentRoute[x].kb, currentRoute[x].lb)
                  latArray[x] = currentRoute[x].kb; //Returns the latitude
                  lngArray[x] = currentRoute[x].lb; //Returns the longitude
                  path.push(pos);
              }
        }
  </code></pre>
  
  <p>The above code works perfect except that the <code>kb</code> and <code>lb</code> properties of the overview path which seem to hold the lat and lng coordinates are not always the same. The last time I made the code, it was <code>kb</code> and <code>lb</code> for few days, and later it changed to <code>mb</code>, <code>nb</code> and today <code>jb</code> and <code>kb</code>.</p>
  
  <p>I dont see any other properties in the object that can provide me the latlng's other than the above. Answers to other similar questions dint mention this issue. Am I missing something here? Any reliable solutions please.</p>