24.11 SDO_GCDR.ELOC_ROUTE_TIME

Format

SDO_GCDR.ELOC_ROUTE_TIME(
  route_preference        IN  VARCHAR2,    
  time_unit               IN  VARCHAR2,    
  start_address           IN  VARCHAR2,    
  end_address             IN  VARCHAR2,    
  country                 IN  VARCHAR2,    
  vehicle_type            IN  VARCHAR2,    
  print_request_response  IN  VARCHAR2 DEFAULT 'FALSE'
) RETURN NUMBER;

or

SDO_GCDR.ELOC_ROUTE_TIME(
  route_preference        IN  VARCHAR2,    
  time_unit               IN  VARCHAR2,
  start_longitude         IN  NUMBER,
  start_latitude          IN  NUMBER,    
  end_longitude           IN  NUMBER,    
  end_latitude            IN  NUMBER,
  vehicle_type            IN  VARCHAR2,    
  print_request_response  IN  VARCHAR2 DEFAULT 'FALSE'
) RETURN NUMBER;

Description

Computes the travel time between two locations.

The input locations can either be single-line addresses or be specified by geographic coordinates.

Parameters

route_preference

Routing preference.

Supported values are: shortest, fastest, and traffic.

time_unit

Unit of time.

Supported values are: hour, minute, and second.

start_address

Complete start address (not formatted into separate fields).

end_address

Complete end address (not formatted into separate fields).

country

ISO 2-character country code. See Country codes in ISO Online Browsing Platform (OBP) to view the list of supported codes.

start_longitude

Longitude value of the starting point.

start_latitude

Latitude value of the starting point.

end_longitude

Longitude value of the ending point.

end_latitude

Latitude value of the ending point.

vehicle_type

Type of vehicle considered for computing the distance.

Supported values are: auto and truck

print_request_response

Determines if the request sent and response received are to be printed.

By default, the parameter value is 'FALSE'.

Usage Notes

Note:

  • The SDO_GCDR.ELOC_ROUTE_TIME function is supported only on Oracle Autonomous AI Database.
  • To use this function on an Autonomous AI Database instance, ensure that you have been granted the required privileges. See SDO_GCDR.ELOC_GRANT_ACCESS for more information.

The SDO_GCDR.ELOC_ROUTE_TIME function can accept one of the following sets of parameters to compute the travel time between two points:

  • Using unformatted addresses: Provide the start_address and end_address parameters where the complete address is stored in a single field (that is, unformatted).
  • Using geographic coordinates: Provide the start_longitude, start_latitude, end_longitude, and end_latitude parameters to determine the start and end locations.

Note that each parameter input can be a column from a table or view, or an explicit string or number value.

Examples

The following example computes the travel time (in minutes) for a fastest route taken by an auto between two locations determined by the geographic coordinates.

SELECT SDO_GCDR.ELOC_ROUTE_TIME('fastest', 'minute', -122.39436, 37.79579, -122.40459, 37.74211, 'auto') route_time FROM DUAL;

ROUTE_TIME 
---------- 
      8.02

The following example computes the travel time (in minutes) for a fastest route taken by a truck between two address locations. Also, note that the query produces the request and response output as the print_request_response parameter is set to TRUE.

SELECT SDO_GCDR.ELOC_ROUTE_TIME('fastest', 'minute', '1 Oracle Dr, Nashua, NH', '45 Middlesex road, Tyngborough, MA', 'US', 'truck', 'TRUE') route_time FROM DUAL;

ROUTE_TIME
----------
     11.24

1 row selected.

REQUEST: xml_request=<route_request id="1" route_preference="fastest"
time_unit="minute" vehicle_type="truck"> <start_location> <input_location
id="1"> <input_address><unformatted country="US" > <address_line value="1 Oracle
Dr, Nashua, NH"/> </unformatted></input_address>
</input_location></start_location> <end_location> <input_location id="2">
<input_address><unformatted country="US" > <address_line value="45 Middlesex
road, Tyngborough, MA"/> </unformatted></input_address>
</input_location></end_location> </route_request>

RESPONSE: {
  "type" : "Feature",
  "geometry" :
{"type":"Polygon","coordinates":[]},
  "properties" : {
    "requestType" :
"route",
    "featureType" : "route",
    "stepCount" : "0",
    "dist" :
"6.3",
    "distUnit" : "mile",
    "time" : "11.24",
    "timeUnit" : "minute"

}
}