Mapbox Nav Matrix Get Matrix

1.6 credits/call
ae_mapbox_nav_matrix_get_matrix

Calculate travel times and distances between multiple locations to build a routing matrix.

MapsTravel
1.6 credits/call

Pricing

1.6 credits/call
ConditionCharge
Each call1.6 credits/call

Parameters

Optional parameters use the platform defaults when omitted.

ParameterTypeRequiredDescriptionDefault
profileenum (mapbox/driving | mapbox/walking | mapbox/cycling | mapbox/driving-traffic)YesA Mapbox Directions routing profile ID.—
sourcesstringNoUse the coordinates at a given index as sources. Possible values are: a semicolon-separated list of 0-based indices, or all (default).—
bearingsstringNoA semicolon-separated list of headings and allowed deviation indicating the direction of movement. Input as two comma-separated values per location: a heading course measured clockwise from true north between 0 and 360, and the range of degrees by which the angle can deviate.—
depart_atstringNoSpecifies the desired time of departure to account for future traffic conditions and road restrictions. Formatted in ISO 8601 format: YYYY-MM-DDThh:mm:ssZ, YYYY-MM-DDThh:mmss±hh:mm, or YYYY-MM-DDThh:mm.—
approachesstringNoA semicolon-separated list indicating the side of the road from which to approach waypoints in a requested route. Accepts unrestricted (default, route can arrive at the waypoint from either side of the road) or curb (route will arrive at the waypoint on the driving_side of the region).—
annotationsenum (duration | distance | duration,distance)NoUsed to specify the resulting matrices. Possible values are: duration (default), distance, or both values separated by a comma.—
coordinatesstringYesA semicolon-separated list of {longitude},{latitude} coordinates. There must be between two and 25 coordinates. For the mapbox/driving-traffic profile, the maximum is 10 coordinates.—
destinationsstringNoUse the coordinates at a given index as destinations. Possible values are: a semicolon-separated list of 0-based indices, or all (default).—
fallback_speedintegerNoBy default, if there is no possible route between two points, the Matrix API sets the resulting matrix element to null. Set this parameter to a value greater than 0 in kilometers per hour to replace null values with straight-line estimates.—

Invocation example

Copy the request and explore its response example.

POST/agent-api/v1/tool/executeX-Api-Key
Request coderequest.sh
curl --request POST \
  --url 'https://agentearth.ai/agent-api/v1/tool/execute?tool_name=ae_mapbox_nav_matrix_get_matrix' \
  --header "X-Api-Key: $AGENTEARTH_API_KEY" \
  --header 'Content-Type: application/json' \
  --data-raw '{
  "params": {
    "annotations": "duration,distance",
    "coordinates": "121.602945,31.088044;121.617523,31.186512",
    "profile": "mapbox/driving"
  }
}'
Response exampleresponse.json
JSONPartial content
{
  "code": "Ok",
  "destinations": [
    {
      "distance": 5.987577405,
      "location": [
        121.602944
      ],
      "name": "申嘉湖高速"
    }
  ],
  "distances": [
    [
      0
    ]
  ],
  "durations": [
    [
      0
    ]
  ],
  "sources": [
    {
      "distance": 5.987577405,
      "location": [
        121.602944
      ],
      "name": "申嘉湖高速"
    }
  ]
}

This example shows part of the response. Copied content is valid JSON.