public static ResultObject retrieveDirectionInfo(IGeography sourceLocation, IGeography destLocation, DateTime departureTime, DateTime arrivalTime)
|
Name
|
Required?
|
Description
|
|---|---|---|
|
sourceLocation
|
Yes
|
Starting location for the drive.
|
|
destLocation
|
Yes
|
Destination location for the drive.
|
|
departureTime
|
No
|
Desired departure time. Times cannot be in the past.
|
|
arrivalTime
|
No
|
Desired arrival time.
|
|
|
At this time, departureTime and arrivalTime are supported only for Google Maps and OSM/MapBox. You can specify either of these parameters, but you cannot use both at the same time.
|
|
Name
|
Description
|
|---|---|
|
status_code
|
Status code of the API response. For more information, see Drive Time API Response Status Codes below.
|
|
status_message
|
Status message of the API response.
|
|
direction_info
|
Direction information in JSON format.
|
|
total_duration
|
Total drive time duration from starting to destination locations, in minutes.
|
|
total_distance
|
Total distance between starting and destination locations, in meters.
|
{
"status_code": 0,
"status_message": "Success",
"direction_info": {
"total_duration": "23",
"total_distance": "11543.6"
}
}
|
Code
|
Message
|
Description
|
|---|---|---|
|
0
|
Success
|
Request successful. Drive time and direction information returned.
|
|
1
|
Request success but no result return.
|
Request successful. No route or road segments found for specified location, therefore no results returned.
|
|
2
|
Request success with multiple results return.
|
Request successful. Multiple results returned.
|
|
3
|
Invalid request
|
Missing sourceLocation or destLocation parameters, or departuretTime and arrivalTime parameters specified together.
|
|
4
|
No default map provider specified in current setting.
|
No default map provider configured in the active system setting.
|
|
5
|
Invalid API Key.
|
Specified API key is invalid.
|
|
6
|
Invalid signature or client id.
|
Specified signature value is invalid for the specified client ID, or the specified client value is invalid.
|
|
7
|
Request over query limit.
|
Request exceeds the query quota.
|
|
8
|
Unable to authenticate the request.
|
Unsuccessful request caused by a map provider server authentication issue.
|
|
9
|
Current map provider is not supported.
|
Current map provider not supported for the Drive Time and Direction API. At this time, only Google and OpenStreetMap are supported.
|
|
11
|
Failed to encode location.
|
Failed to encode geographic location.
|
|
13
|
The requested route is too long and cannot be processed.
|
The distance between the starting location and destination exceeds the maximum route value that can be calculated.
|
|
101
|
Server Internal Error.
|
Server internal errors occurred on the map provider server.
|
|
102
|
Unknown error.
|
Other unknown errors returned from the map provider server.
|
import import com.servicemax.mapproviders.MapProviderManager
import com.intalio.com.data.geography.Geography
import com.intalio.core.data.api.IGeography
import org.joda.time.DateTime
IGeography source = new Geography("37.3893889","-122.0832101")
IGeography destination = new Geography("38.3893889","-122.0832101")
DateTime departureTime = new DateTime('2020-11-12T08:00:00.000Z')
def res = MapProviderManager.retrieveDirectionInfo(source, destination, departureTime, null);