## Calculate a distance matrix between points `routing.matrix(**kwargs) -> MatrixResult` **post** `/api/v1/matrix` Calculate a distance matrix between points ### Parameters - `destinations: GeoJsonGeometry` Destination points (GeoJSON MultiPoint geometry) - `coordinates: Array[Float] | Array[Array[Float]] | Array[Array[Array[Float]]] | Array[Array[Array[Array[Float]]]]` GeoJSON coordinates array (nesting depth varies by geometry type) - `Array[Float]` - `Array[Array[Float]]` - `Array[Array[Array[Float]]]` - `Array[Array[Array[Array[Float]]]]` - `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 - `class MatrixResult` - `distances: Array[Array[Float]]` Distance matrix (meters), origins x destinations - `durations: Array[Array[Float]]` Duration matrix (seconds), origins x destinations ### Example ```ruby require "plaza" plaza = Plaza::Client.new( api_key: "My API Key", environment: "local" # defaults to "production" ) matrix_result = plaza.routing.matrix( destinations: {coordinates: [0], type: :Point}, origins: {coordinates: [0], type: :Point} ) puts(matrix_result) ``` #### Response ```json { "distances": [ [ 0 ] ], "durations": [ [ 0 ] ] } ```