Compute a route itinerary
In this guide we will
- compute a route itinerary
- intercept the result
- display the result on the map
Follow common setup steps
If not done already, follow common Introduction page.
Compute a route itinerary
For example in the actual ARData, there is a route in the referencePlanning
that has the following id :
- 4FADCFA9-012E-4B6C-A74A-E8B440EE3A7C
Send a Route itinerary message.
Payload for RUN_ROUTE_LINK message
{
"routeId": "4FADCFA9-012E-4B6C-A74A-E8B440EE3A7C"
}
Listen to the resolution progress
We will only listen to the Job progress event message having action
equals to "MCIINDEPENDANTJOB"
Receiving the solution may take a few seconds to some minutes, depending on the problem complexity and Axioroute Service traffic.
You can display the percent
(if exists) and the message
values, until lastMessage
is set to true.
Payload example of a RUN_MCI job progress event message
{
"api": "MCDI",
"jobId": "94af85b7-37c8-4cb8-9fbd-f2ba58114ac7",
"action": "ROUTELINK",
"progress": "COMPLETE",
"lastMessage": true,
"statusCode": 200,
"message": "Itinerary : 1704,687 Km, 16:24'52\"",
"entityType": "ROUTELINK",
"jobData": { ... }
}
Receiving the solution may take a few seconds to some minutes, depending on the problem complexity and Axioroute Service traffic.
You can display the percent
(if exists) and the message
values, until the lastMessage
property in the message is true.
Send the result
Send the content of the jobData
in a ADD_SDK_ENTITIES message.
A Entities event message is sent, with mciRouteLinks
value containing the jobData
.