Get started
Routing

Matrix

Matrix

The matrix query of the Data API. Every request is a POST to https://data.mountaya.com/graphql with a publishable key and a session token: see Authentication.

matrix

POST
/graphql

Compute a time-distance matrix between locations for a given activity. Returns duration and/or distance grids between all source-destination pairs.

Arguments

input

MatrixInput!

required

The origins and destinations to measure between, the activity, and which metrics to compute.

Returns

matrix

MatrixResult!

required

Result of a matrix computation.

Errors A field the API refuses is answered 200, its entry in errors beside the data that resolved. See Errors.

curl https://data.mountaya.com/graphql \
  -H "X-API-Key: pk_your_publishable_key" \
  -H "X-Session-Token: sess_your_session_token" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "query Matrix($input: MatrixInput!) { matrix(input: $input) { distances durations } }",
    "variables": {
      "input": {
        "activity": "HIKING_AND_TRAIL",
        "locations": [[6.8712, 45.9231], [6.9271, 45.9822]],
        "metrics": ["DURATION", "DISTANCE"]
      }
    }
  }'