• Optimization
  • Navigation
  • Tracking
  • Maps
  • Places

ETAs for cross-border trips

Implement Using: Distance Matrix Flexible API


In this example, let’s request for distance and duration values for a route that a truck can take when allowed to cross country borders. We will create a Distance Matrix Flexible request with 2 origins (O) and 2 destinations (D). We set option as flexible along with:

  • mode set to “truck” to get distance and duration values for a route that a truck can take
  • cross_border option set to “true”

Request

1curl --location 'https://api.nextbillion.io/distancematrix/json?origins=48.96845365,-110.21708796|48.96266414,-109.73794494&destinations=48.95108310,-110.22002749|48.95494374,-109.72324730&mode=truck&key=<your_api_key>&option=flexible&cross_border=true'

Response

1{
2 "status": "Ok",
3 "rows": [
4 {
5 "elements": [
6 {
7 "duration": {
8 "value": 90
9 },
10 "distance": {
11 "value": 1933
12 }
13 },
14 {
15 "duration": {
16 "value": 7894
17 },
18 "distance": {

Have Questions ?