Can Google Maps Distance Matrix API calculate travel time between addresses?

Asked 2 years ago, Updated 2 years ago, 117 views

I'm looking for an API to calculate the commuting time (public transportation) between addresses and the nearest station to the address.

Please allow me to confirm the following two points.

(1) Is it possible to calculate the travel time between addresses and the nearest station to the address using the Google Maps Distance Matrix API?

(2) If (1) above is possible,
You will be using the Google Maps Distance Matrix API.
The travel time and
when using the API. If I search Google for Travel Time: Nishi Narashino 1-chome, Funabashi City, Chiba Prefecture, Numazu, Shizuoka Prefecture, will the result be the same as the travel time (select the public transportation tab)?
I'd like to see what kind of search results I can get from the Google Maps Distance Matrix API.

google-maps

2022-09-30 16:53

1 Answers

It is recommended that you read the document first, as it is roughly documented: https://developers.google.com/maps/documentation/distance-matrix

The Distance Matrix API is an API that calculates and returns travel time and distance when you travel from the starting point to the arrival point using a specific method.This gives you travel time.

On the other hand, the nearest station is difficult.There is a problem with how to define the "nearest station" in the first place, and the Distance Matrix API does not return route information (use the Directions API if you want route information as described in https://developers.google.com/maps/documentation/distance-matrix/overview.If you want to know the nearest station as the starting point and all the surrounding stations as the arrival point, you can derive the shortest travel time, but I think the cost often doesn't match.

And these results are not guaranteed to match the results of Google Maps route searches, or rather, the format of requests and responses is different, so I'm not sure what matches them.I think it would be good to reconsider why we have to make sure it matches in the first place.

Finally, the Distance Matrix API is not a particularly expensive API, and it's easy to set a price by hitting it yourself a few times: https://developers.google.com/maps/documentation/distance-matrix/usage-and-billing.First of all, I think it's the quickest way to understand if you make a request with the appropriate data and check the behavior.Also, if it's really hard for you to do it yourself, a specific example of your request and response can be found in https://developers.google.com/maps/documentation/distance-matrix/distance-matrix#distance-matrix-responses.


2022-09-30 16:53

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.