Can I transfer multiple riding modes using the Google Maps Distance Matrix APIs

I need to calculate the time and distance using multiplayer modes, I am trying to convey several motion modes, separated by | eg:

https://maps.googleapis.com/maps/api/distancematrix/json?origins=E149AQ&destinations=UB83PH|NW14SA|WC1E7HU|N78DB&mode=walking|bicycling|driving&language=en-GB&key=myKey 

But it does not work as I expected.

+5
source share
1 answer

Only one move mode is supported for each request. To get results for several modes of movement, run several queries.

The documentation implies this, but does not explicitly state it:

Extra options

(default for driving) . Indicates the mode of transportation used in calculating the distance. Valid values ​​and other request data are listed in the "Modes of Movement" section of this document.

Travel modes

To calculate distances, you can specify the transportation mode used. By default, distances are calculated for driving. The following moving modes are supported:

  • Driving (default) means calculating distances using the road network.

  • Walking asks for a distance calculation for walking along walkways and sidewalks (if any).

  • bicycling requests a calculation of the distance for the bike along the bike lanes and preferred streets (if any).

  • requests calculation of distance along public transport routes (if any). This value can only be specified if the request contains an API key or a Google Maps API client identifier for operation. If you set the mode for the transition, you can specify either the departure time or the arrival time. If no time is specified, then by default the departure_time parameter is set to (that is, the default departure time is the same as the current time). In addition, you can also specify transit_mode and / or program_ transport_file.

Note. In both directions of walking and cycling, sometimes there may not be clear pedestrian or bicycle paths, so these directions return warnings in the return result that you must display to the user.

+5
source

Source: https://habr.com/ru/post/1234910/


All Articles