Google maps (routes)


I am using google Maps for my App. It shows the location from the origin to the destinations.
But the problem is, if it’s outside the road, the route will not go there.

It will just stop on the road, like this:
I have tried different ways to solve the problem but still got the same thing.
What would be the best thing to do? Thank you :grin:

This is my code:

var locations = [
      [1,10.357918, 123.914345],
      [2,10.357813, 123.915150],
      [3,10.358823, 123.915670],
      [4,10.357203, 123.914310],
      [5,10.358567, 123.914919]
        var pos = {
          lat : position.coords.latitude,
          lng : position.coords.longitude
for (i = 0; i < locations.length; i++) {
          marker = new google.maps.Marker({
          position: new google.maps.LatLng(locations[i][1], locations[i][2]),
          map: map,
          icon: 'assets/images/man.png'
        var posi = {
          lat : locations[i][1],
          lng : locations[i][2]
        var directionsRequest = {
          origin: pos,
          destination: posi,
          travelMode: google.maps.DirectionsTravelMode.DRIVING
directionsService.route(directionsRequest, function(response){
            new google.maps.DirectionsRenderer({
              map : map,
              directions : response,
              suppressMarkers: true

What will I do??

Maybe you could post your answer to your own question here? Others might find this helpful when going through the forum :-).

The idea is to place the solutions that are found so that another user who has the same problem can help with your solution.