title: Google Maps Directions API showing wrong directions
body: <p>I am using the Google Maps API and the Google Maps Directions API for tracking the journey of a pilgrimage. <strong>My travel mode is walking and I have 8 waypoints placed along the way (Google doesn't allow you to add more for free)</strong>.</p>
  
  <p>The problem is that Google Maps is taking an odd unsought detour from the original path. I set up LatLng coordinates as waypoints accordingly to fix the problem, but the API remains stubborn on its resolve to take me 200 km away from the path and back again...</p>
  
  <p>I have attached a screenshot of the app with this question. As you can see, in the bottom right corner, Google Maps takes a detour. How do I fix the problem? Thank You.<img src="https://i.stack.imgur.com/3fXmj.jpg" alt="enter image description here"></p>
  
  <p>Here's some code:</p>
  
  <pre><code>String url = "https://maps.googleapis.com/maps/api/directions/json?origin=18.6769503," +
              "73.8945701&amp;destination=17.6774444,75.3329239&amp;mode=walking&amp;waypoints=" +
              "via:Saswad,MH|via:Jejuri,MH|via:Natepute,MH|" +
              "via:Velapur,MH|via:Bhandishegaon,MH|via:Wakhari,MH|" +
              "via:17.685236,75.287492|via:17.682496,75.304931&amp;" +
              "key=MY_API_KEY";
  
      RequestQueue requestQueue = Volley.newRequestQueue(this);
      StringRequest jsonObjectRequest = new StringRequest(Request.Method.GET, url,
              new Response.Listener&lt;String&gt;() {
  
                  @Override
                  public void onResponse(String response) {
                      Log.i("Json Data", "Successfully Retrieved - Starting Parse Process");
                      mapJsonData = response;
                      try {
                          parseJsonData(mapJsonData);
                      } catch (JSONException e) {
                          e.printStackTrace();
                      }
  
                      PolylineOptions polyOptions = new PolylineOptions().geodesic(true).
                              color(Color.RED).
                              width(10);
                      polyOptions.add(dnyaneshwarOrigin);
                      for (int i = 0; i &lt; polyPoints.size(); i++) {
                          polyOptions.add(polyPoints.get(i));
                      }
                      polyOptions.add(vitthalMandir);
                      gMap.addPolyline(polyOptions);
  
                      final LatLngBounds.Builder builder = new LatLngBounds.Builder();
                      builder.include(dnyaneshwarOrigin);
                      builder.include(vitthalMandir);
  
                      mapLayout.getViewTreeObserver().addOnGlobalLayoutListener
                              (new ViewTreeObserver.OnGlobalLayoutListener() {
                          @Override
                          public void onGlobalLayout() {
                              LatLngBounds bounds = builder.build();
                              gMap.animateCamera(CameraUpdateFactory.newLatLngBounds
                                      (bounds, 20));
                          }
                      });
                  }
              }, new Response.ErrorListener() {
  
          @Override
          public void onErrorResponse(VolleyError error) {
              Log.e("Response Error", "Could Not Retrieve Json Data");
              Toast.makeText(MapActivity.this, "Error Retrieving Json Data",
                      Toast.LENGTH_SHORT).show();
          }
      });
      Log.i("Request Queue", "Sending Json Request");
      requestQueue.add(jsonObjectRequest);
  </code></pre>