Routing for hazardous material

Products Used: Directions API & Navigation API


NextBillion.aiโ€™s routing APIs also take into account the kind of material your vehicles are transporting. Use the โ€œhazmat_typeโ€ parameter to describe the type of hazardous material that is being carried and the routing engine will only suggest the routes that are suitable for the vehicle to pass through. This feature ensures that the vehicle takes only the safe and legal routes to the destination.

Letโ€™s take a look at the following request which makes use of

  1. An โ€œoriginโ€ and โ€œdestinationโ€ for the trip
  2. โ€œmodeโ€ option set to โ€œtruckโ€
  3. โ€œoptionโ€ attribute set to โ€œflexibleโ€
  4. โ€œhazmat_typeโ€ indicating one of the recognized hazardous material types

Directions API request

1curl --location 'https://api.nextbillion.io/directions/json?key=<your_api_key>&origin=48.22539980,-101.29602541&destination=48.24027183,-101.29608570&mode=truck&option=flexible&hazmat_type=circumstantial'

Directions API response

1{
2 "status": "Ok",
3 "routes": [
4 {
5 "geometry": "w_jeHfkgiRX@hA@@?tA?zCClBDf@?v@?tCGhJ???tDAtAAzA?l@?~DBd@???zA@hE?@?x@???fB???dF@??zBAlB?@?L???nB???^A??b@???b@A??hAA@?RA@?p@C??RL?@hAATA|AA`A@??fA@J@??RFRBNDPLFNDXDt@B~@FtEFxBBxA@d@???pCArFWrCi@jGOjBu@dIg@nF?@CTQzB??a@dEk@xFYpC??ShCa@bEs@`H_BlP??O|AC`@O~AC^?@Ep@?@MhAEf@M|AA@WrCUvBSzA??S`BOdAUlA[bB]~ASx@Qp@Mh@Sn@Wz@]dA_@bACHUf@?@AB[r@ABc@|@o@rAA@mDzGIN{DpHiChFA?Yj@{GrMcAlBy@`B??Yj@cAhBa@t@??_@p@??EJyApCsCjFABA?{@zAcAfBu@`B??uAdDYx@Ut@U|@A@ADQv@GX?@IZO|@OfAEf@A?Gv@Cj@E|@?@G`Bs@SQGq@SMWGCmBo@s@W?AaBe@gBg@aCi@oCo@??uCk@_IsAOC??mDo@??oEy@??{Ba@oCg@??o@M??mEy@{Cq@yDaAs@QA?wC{@c@KgAY??e@MqCw@wB}@}Am@k@Yg@]q@e@QQSSUWg@o@i@o@QWGGCEKE@i@?S?A?W?S?{A?y@@}D?A?cC?a@?OAeA???oAA]@iA?_B??AyEA}E?sB???}C?uC?{C?cA?oA?A?uA?A?kA???eA?I?A?_A?s@?]?A@iA?A?kA?u@?_B?A?e@???{B???oC??AeC?kC?aC??@kC?eD??AiB??DaM@iG@]B[BSDYLe@HWHM??FKT]f@m@n@o@^g@Tg@Ng@He@D_@?ADe@?k@AIIkAA]Io@A[AW?m@AcABgG??BcI?A?sC?{C?}B?A@S@uC?uC??AwC??AsACm@CYIg@Mg@q@eC?Ac@wAAAa@sASy@I_@??AEOs@Ic@EYC[CiAAaAw@C",
6 "distance": 11037.742,
7 "duration": 1026.317,
8 "start_location": {
9 "latitude": 48.2254,
10 "longitude": -101.29604
11 },
12 "end_location": {
13 "latitude": 48.24027,
14 "longitude": -101.29607
15 },
16 "legs": [
17 {
18 "distance": {

Notice that if the โ€œhazmat_typeโ€ configuration is removed from the input request the route suggested for a general truck is quite shorter than what is safe for a truck carrying hazardous material.

Letโ€™s take a look at how a Navigation API call would look like for the exact same parameters as the above example.

1curl --location 'https://api.nextbillion.io/navigation/json?key=<your_api_key>&origin=48.22539980,-101.29602541&destination=48.24027183,-101.29608570&mode=truck&option=flexible&hazmat_type=circumstantial'
1{
2 "status": "Ok",
3 "routes": [
4 {
5 "geometry": "ofm~zAfyre`ElGT~UXD?`Z?to@_@na@p@lK@hPBfn@iAzoBIF?pw@WjZKl[KrMFzz@b@xJFD?n[Pl~@?@?nQ?B?~^EB?zfAP??te@Kxa@CF?nCA??xa@?@?bIIF?fJK@?tIM@?pVW@?vEOF?tNk@F?|DvCBBjVSlEEp\\YvSND?jU\\jBHB?lEjAbEn@fDv@lDfCxAjDz@xFt@~Od@fStA~aA|@`e@t@|ZHtJ?@Fzl@]|jAgFpm@aLfrAgDv`@yOzdBkKfjAAJc@hF{Dre@?BuIr|@oL`mA{Ftl@ADsEfj@uI`|@aOxyAc]bmD?BoCj\\u@vI_D~\\a@~HAHcAtNAJ{BtV_AdKuCp\\AF{Frm@wEpd@cEt[?BkEd]_D|TuEdWiHx^iHv\\eE~PqDzNkC|K{D|MmFtQuH~TyHbTs@dBoEtKCF[t@sGfOSb@cJhRiNpYA@ku@|wAeBdD{y@x~Aoj@tgAEHgGlLswAdqCcTxa@oQp]AB_GfLcTf`@yIbPA@sHhNCB{@~Bk[fl@cm@thAYd@CDiRv[ySj_@yOt]CFyYpr@gGbQwEbPiFhRCJYdA{DlPoAhGAByAdH}ClRyCnUoAhKAFmA|Om@zL}@xR?HuAz]{NkEcEiAqNsEcCeFsAo@aa@gNiOoFCAo]gKw_@gKwg@qL}k@}MCAsm@wLybBwXiDo@CAcu@aNEAs_A}P??}e@uIwk@eKEA{MgCC?s_AoQyo@kN_y@{SgOuDEA{n@gQ}IaC{UiGCAoJkCsl@gPqd@eRo\\qM}LeGcKaHqN_KqDqDmEgEsEoFsKcNcL_N{DgFcAqAs@y@oBiALcLDgE?G?wF?_E?a\\@_QHqz@?IAch@AsI?oDIoT?KKaXCkHDsUDk]?AQecAQ_dAEgc@?KByo@Acn@B{o@AmTF}W?II_Z?K?sV?EBcU?eB?E@eS@qO@gH?GJsV?KEqVAyOAk]?K@yJ???we@?I?uk@??Ici@Iuj@?mg@?MXyj@Emr@?CC{_@?Ml@mkCX{qATuHd@}Gh@yDx@eGfC_KnBuFrA}B@AnAyBbFsHjKmMbNqMzHsK`F}KxCaKlB}Jt@iI@Gl@{JH{LMkBcByVc@{GqAmN]sGOiFEeMGoTb@sqA??`@cdB?KCgm@A{o@Nsf@?K@kERcn@Akm@?KCen@?IOaYm@gMi@kGaBoKeCmK}Nai@ACmJ_[CGsIwYqEyPgBwH??S{@yCeOaBsJy@kGi@kGq@aVE_TwPg@",
6 "distance": 11037.742,
7 "duration": 1026.454,
8 "start_location": {
9 "latitude": 48.2254,
10 "longitude": -101.296036
11 },
12 "end_location": {
13 "latitude": 48.240271,
14 "longitude": -101.296066
15 },
16 "legs": [
17 {
18 "distance": {

Visit product documentation (Directions API | Navigation API) to know more about the available features.


Have Questions ?