Trace Route Taken

Product Used: Post Trip Route API


Using NextBillion.ai’s Post Trip Route API you can trace the actual route taken by your truck. The Post Trip API will take into account a list of locations tracked while the truck was on trip and returns the total distance of the trip along with the geometry of the route taken.

This information is quite helpful in tackling business cases needing to track the miles covered for fuel reimbursement or quality assessments post-service.

Following is a sample request with

  1. list of tracked location coordinates provided as input for waypoints.

  2. mode option set to truck

  3. geometry parameter is set to polyline6 to indicate the format in which the path geometry is needed.

Post Trip Route API request:

1
2
3
4
5
6
7
curl --location 'https://api.nextbillion.io/postTripRoute?key=<your_api_key>' \
--header 'Content-Type: application/json' \
--data '{
"waypoints":"34.04932289,-118.25573833|34.04711381,-118.24976846|34.04153727,-118.2310818|34.03881998,-118.20756901",
 "mode":"truck",
 "geometry": "polyline6"
}'

Post Trip Route API response:

1
2
3
4
5
6
7
{
  "status": "Ok",
  "route": {
    "geometry": "wyd}_A~_vp`FnKrIbV_b@rSc`@jCgEzO{YfEkHzJwQvBgEzTc`@~H_NnKcQrIoPrIgOvGwLbLsSjHkMnKkR~CoFnAkCnKwQ_NsN_IsI{EgEwVcV{E{EcGoFsIrNvLfJ~CjCjHbGz@nAf@z@?nASbB{@bBg@f@oA?oAg@kRwQgE{E??{@oARoAjCgErIsN{O{Og^_]_XkWcLgJsSoPvB_DbBwBbQ{TvG_IvG_I~C_DzEwGnAcBnAwBnAwBf@oAz@oAvBoFvBgEvQce@nAkCbG_NvB{EvBwG~CcLbBsIjM{h@vBoKnFoPbGwL~Rw`@j\\sl@j\\wo@r]on@fJkRrD_Iz@kCnA_DvLkp@z@_InAwGR_DR_DRgE?gESoAg@{Jg@kHwB{^ScBSwBg@gJg@wL_Dgh@SwBg@wL?sDRcG?cBR_Df@sDRwBvB_IzE{JbLsSzJ_S~R_b@~a@{w@nPs]bBsDbBgEz@wBf@kCz@kCf@sDz@gEz@gERsDRoFRwG?{@g@cwAS_XSgY?wB?kC?_D?g@SsX?wBSgYS{Jg@sDg@gEoA{JoA{Eg@sDoUchAgE{TcLkk@cGk\\sIka@cGoZg@kCg@oAoAwGSwBSkCScGg@g^g@g^g@sNSkHSoK?kHSsN?gOSkC?_DSgES{TSgOg@wLSwQ{@we@S_S?cGSwB?oA?_NRgE?kCz@oFRoAnAoFR{@f@cBR{@f@cBnAgEbBoFrD{JjCsIjHsS~Rwj@jCsIjCkH~CgJvBcGfOod@nPwe@~HcVzE_NzE_NjCsIf@oAjC_IrDgJjCgJbGwQzE_Nz@wBbGoPnAsDrDoKfE_NbGcQv[c~@jH{TnUsq@",
    "distance": 5277.3
  }
}

On successfully submitting the above request the service responds with total distance covered by the truck along with the geometry of the route.

Visit Post Trip Route API documentation to know more about the available features.


Have Questions ?