0

I want to draw a route without traffic calculation. I try distance matrix service but ı can't find solution so when the response back from distance matrix service ı want to compare the routes and send shortest path to drawing but ı failed that too... Can you guys help or suggest anything?

 directionsService
            .route({
                origin: document.getElementById("start").value,
                destination: document.getElementById("end").value,
                travelMode: "DRIVING",
                unitSystem: google.maps.UnitSystem.METRIC,

                drivingOptions: {
                    departureTime: new Date(Date.now()),
                    trafficModel: 'pessimistic'
                }
            })

            .then((response) => {

                directionsRenderer.setDirections(response);

                console.log(response);

                for (var i = 0; i < response.routes.length; i++) {
                    shortest.push(response.routes[0].legs[i].distance.value);
                }
                console.log(shortest);

            })
Hasan Kirtil
  • 123
  • 5

1 Answers1

0

I want to draw a route without traffic calculation.

As far as I can tell, this is not possible. It looks like you already found the traffic_model parameter for modifying traffic assumptions.

Justin Poehnelt
  • 2,992
  • 1
  • 19
  • 23
  • İs there any other way without this code? any possible algorithm for calculating distance ? or is there any other technique for not including traffic at all? – Hasan Kirtil Oct 18 '21 at 11:41