com.google.maps

Class DistanceMatrixApiRequest

  • java.lang.Object
    • com.google.maps.DistanceMatrixApiRequest
  • All Implemented Interfaces:
    PendingResult<DistanceMatrix>


    public class DistanceMatrixApiRequestextends java.lang.Object
    A request to the Distance Matrix API.
    • Constructor Detail

      • DistanceMatrixApiRequest

        public DistanceMatrixApiRequest(GeoApiContext context)
    • Method Detail

      • validateRequest

        protected void validateRequest()
      • origins

        public DistanceMatrixApiRequest origins(java.lang.String... origins)
        One or more addresses from which to calculate distance and time. The service will geocode the string and convert it to a latitude/longitude coordinate to calculate directions.
        Parameters:
        origins - String to geocode and use as an origin point (e.g. "New York, NY")
      • origins

        public DistanceMatrixApiRequest origins(LatLng... points)
        One or more latitude/longitude values from which to calculate distance and time.
        Parameters:
        points - The origin points.
      • destinations

        public DistanceMatrixApiRequest destinations(java.lang.String... destinations)
        One or more addresses to which to calculate distance and time. The service will geocode the string and convert it to a latitude/longitude coordinate to calculate directions.
        Parameters:
        destinations - String to geocode and use as a destination point (e.g. "New Jersey, NY")
      • destinations

        public DistanceMatrixApiRequest destinations(LatLng... points)
        One or more latitude/longitude values to which to calculate distance and time.
        Parameters:
        points - The destination points.
      • departureTime

        public DistanceMatrixApiRequest departureTime(org.joda.time.ReadableInstant departureTime)
        Specifies the desired time of departure.

        The departure time may be specified in two cases:

        • For requests where the travel mode is transit: You can optionally specify one of departure_time or arrival_time. If neither time is specified, the departure_time defaults to now (that is, the departure time defaults to the current time).
        • For requests where the travel mode is driving: Google Maps API for Work customers can specify the departure_time to receive trip duration considering current traffic conditions. The departure_time must be set to within a few minutes of the current time.

        Setting the parameter to null will remove it from the API request.

        Parameters:
        departureTime - The time of departure.
      • arrivalTime

        public DistanceMatrixApiRequest arrivalTime(org.joda.time.ReadableInstant arrivalTime)
        Specifies the desired time of arrival for transit requests. You can specify either departure_time or arrival_time, but not both.
      • transitModes

        public DistanceMatrixApiRequest transitModes(TransitMode... transitModes)
        Specifies one or more preferred modes of transit. This parameter may only be specified for requests where the mode is transit.
      • transitRoutingPreference

        public DistanceMatrixApiRequest transitRoutingPreference(TransitRoutingPreference pref)
        Specifies preferences for transit requests. Using this parameter, you can bias the options returned, rather than accepting the default best route chosen by the API.
      • await

        public final T await()              throws java.lang.Exception
        Description copied from interface: PendingResult
        Performs the request synchronously.
        Specified by:
        await in interface PendingResult<T>
        Returns:
        The result.
        Throws:
        java.lang.Exception
      • awaitIgnoreError

        public final T awaitIgnoreError()
        Description copied from interface: PendingResult
        Performs the request synchronously, ignoring exceptions while performing the request and errors returned by the server.
        Specified by:
        awaitIgnoreError in interface PendingResult<T>
        Returns:
        The result, or null if there was any error or exception ignored.
      • cancel

        public final void cancel()
        Description copied from interface: PendingResult
        Attempt to cancel the request.
        Specified by:
        cancel in interface PendingResult<T>
      • param

        protected A param(java.lang.String key,                  java.lang.String val)
      • param

        protected A param(java.lang.String key,                  com.google.maps.internal.StringJoin.UrlValue val)
      • params

        protected java.util.Map<java.lang.String,java.lang.String> params()
      • language

        public final A language(java.lang.String language)
        The language in which to return results. Note that we often update supported languages so this list may not be exhaustive.
        Parameters:
        language - The language code, e.g. "en-AU" or "es"
        See Also:
        List of supported domain languages
      • channel

        public A channel(java.lang.String channel)
        A channel to pass with the request. channel is used by Google Maps API for Work users to be able to track usage across different applications with the same clientID. See: https://developers.google.com/maps/documentation/business/clientside/quota
        Parameters:
        channel - String to pass with the request for analytics


NOTHING
NOTHING
Add the Maven Dependecy to your project: maven dependecy for com.amazonaws : aws-java-sdk : 1.3.14