Class DirectionsLeg

  • All Implemented Interfaces:
    java.io.Serializable

    public class DirectionsLeg
    extends java.lang.Object
    implements java.io.Serializable
    A component of a Directions API result.

    See the Legs documentation for more detail.

    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      java.time.ZonedDateTime arrivalTime
      The estimated time of arrival for this leg.
      java.time.ZonedDateTime departureTime
      The estimated time of departure for this leg.
      Distance distance
      The total distance covered by this leg.
      Duration duration
      The total duration of this leg.
      Duration durationInTraffic
      The total duration of this leg, taking into account current traffic conditions.
      java.lang.String endAddress
      The human-readable address (typically a street address) reflecting the end location of this leg.
      LatLng endLocation
      The latitude/longitude coordinates of the given destination of this leg.
      java.lang.String startAddress
      The human-readable address (typically a street address) reflecting the start location of this leg.
      LatLng startLocation
      The latitude/longitude coordinates of the origin of this leg.
      DirectionsStep[] steps
      Contains an array of steps denoting information about each separate step of this leg of the journey.
    • Constructor Summary

      Constructors 
      Constructor Description
      DirectionsLeg()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • steps

        public DirectionsStep[] steps
        Contains an array of steps denoting information about each separate step of this leg of the journey.
      • distance

        public Distance distance
        The total distance covered by this leg.
      • duration

        public Duration duration
        The total duration of this leg.
      • durationInTraffic

        public Duration durationInTraffic
        The total duration of this leg, taking into account current traffic conditions. The duration in traffic will only be returned if all of the following are true:
        1. The directions request includes a departureTime parameter set to a value within a few minutes of the current time.
        2. The request includes a valid Maps for Work client and signature parameter.
        3. Traffic conditions are available for the requested route.
        4. The directions request does not include stopover waypoints.
      • arrivalTime

        public java.time.ZonedDateTime arrivalTime
        The estimated time of arrival for this leg. This property is only returned for transit directions.
      • departureTime

        public java.time.ZonedDateTime departureTime
        The estimated time of departure for this leg. The departureTime is only available for transit directions.
      • startLocation

        public LatLng startLocation
        The latitude/longitude coordinates of the origin of this leg. Because the Directions API calculates directions between locations by using the nearest transportation option (usually a road) at the start and end points, startLocation may be different from the provided origin of this leg if, for example, a road is not near the origin.
      • endLocation

        public LatLng endLocation
        The latitude/longitude coordinates of the given destination of this leg. Because the Directions API calculates directions between locations by using the nearest transportation option (usually a road) at the start and end points, endLocation may be different than the provided destination of this leg if, for example, a road is not near the destination.
      • startAddress

        public java.lang.String startAddress
        The human-readable address (typically a street address) reflecting the start location of this leg.
      • endAddress

        public java.lang.String endAddress
        The human-readable address (typically a street address) reflecting the end location of this leg.
    • Constructor Detail

      • DirectionsLeg

        public DirectionsLeg()
    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object