Google Maps JS API routes with and without fares included

117 Views Asked by At

I am using Google Maps JS API and I would like to get for a route 2 different results:

  1. Fastest route with fares enabled
  2. Fastest route without fares

So far I only found the solution that I retrieve multiple routes for a trip, and filter them by the TransitFare attribute (get the route which has a fare, and get a route which's fare is 0), but this does not seem too efficient. Is there another way where I could set a e.g. fareEnabled flag for a request to get a route with or without fares incuded?

1

There are 1 best solutions below

0
Adam Nagy On

So if anyone finds this question I have an answer: https://developers.google.com/maps/documentation/javascript/directions#DirectionsRequests

So avoidTolls: Boolean,

makes sure there are no fares for the route.