## Calculate a distance matrix between points `client.routing.matrix(RoutingMatrixParamsbody, RequestOptionsoptions?): MatrixResult` **post** `/api/v1/matrix` Calculate a distance matrix between points ### Parameters - `body: RoutingMatrixParams` - `destinations: GeoJsonGeometry` Destination points (GeoJSON MultiPoint geometry) - `coordinates: Array | Array> | Array>> | Array>>>` GeoJSON coordinates array (nesting depth varies by geometry type) - `Array` - `Array>` - `Array>>` - `Array>>>` - `type: "Point" | "LineString" | "Polygon" | 3 more` - `"Point"` - `"LineString"` - `"Polygon"` - `"MultiPoint"` - `"MultiLineString"` - `"MultiPolygon"` - `origins: GeoJsonGeometry` Origin points (GeoJSON MultiPoint geometry) - `mode?: "auto" | "foot" | "bicycle"` Travel mode - `"auto"` - `"foot"` - `"bicycle"` ### Returns - `MatrixResult` - `distances: Array>` Distance matrix (meters), origins x destinations - `durations: Array>` Duration matrix (seconds), origins x destinations ### Example ```typescript import Plaza from '@plazafyi/sdk'; const client = new Plaza({ apiKey: process.env['PLAZA_API_KEY'], // This is the default and can be omitted }); const matrixResult = await client.routing.matrix({ destinations: { coordinates: [0], type: 'Point' }, origins: { coordinates: [0], type: 'Point' }, }); console.log(matrixResult.distances); ``` #### Response ```json { "distances": [ [ 0 ] ], "durations": [ [ 0 ] ] } ```