title: Google Maps API: find a main route/Alternate route between two points
body: <p>I want to get the main route between two locations. I have found out the distance and duration but I want to get the main route like in following image I want to get "via 1-57 S". I tried following the code to get directions but I got too many of them; I want only one suggested direction circled in an image.</p>
  
  <p>For example:</p>
  
  <pre><code>directionsService.route(request, function(result, status) {
      if (status == google.maps.DirectionsStatus.OK)
      {
          alert("Root length: "+result.routes.length);
          for (var i = 0; i &lt; result.routes.length; i++)
          {       
              var dur = result.routes[i].legs[0].distance.value/1000;     
              var steps = result.routes[i].legs[0].steps;  
              for (j = 0; j &lt; steps.length; j++) {
                  var nextSegment = steps[j].instructions;
                  alert("nextSegment: " + nextSegment + " path latlong: "+steps[j].path);
              }   
  
              var hours = Math.floor((result.routes[i].legs[0].duration.value)/3600);
              var minutes = Math.ceil(((result.routes[i].legs[0].duration.value) - (hours * 3600)) / 60);
          }        
      }
  });
  </code></pre>
  
  <p>Image:</p>
  
  <p><a href="http://i.stack.imgur.com/BcjE2.png" rel="nofollow">Example image to find main route(circled in image) to reach destination</a></p>