Search code examples
iosgoogle-mapsgoogle-maps-sdk-iosgoogle-geocoding-apigoogle-directions-api

Is it possible to retrieve the time for a route with the iOS Google Maps SDK?


Using the Google Maps SDK for iOS, is it possible to calculate/retrieve the time for a route from location A to location B that is taken by bike, by car or or walking as it is done in the regular Google Maps app for iOS?

I know that directions can be displayed using a GMSPolyLine using the Google Directions API, now is it possible to calculate the time need to walk all the way along the polyline from A to B?


Solution

  • The directions API includes a duration in the legs in the response:

    https://developers.google.com/maps/documentation/directions/#Legs

    These durations will depend on the travel mode (driving, walking, etc) that you specified in the request:

    https://developers.google.com/maps/documentation/directions/#TravelModes