1. Matrices
GraphHopper Directions API
  • Routing
    • Calculate a route
      GET
    • Calculate a route
      POST
  • Isochrones
    • Compute an isochrone
      GET
  • Matrices
    • Compute a matrix
      POST
    • Compute a matrix
      GET
    • Submit a matrix computation job
      POST
    • Retrieve result of a matrix computation job
      GET
  • Map Matching
    • Map-match a GPX file
      POST
  • Geocoding
    • Geocoding Endpoint
      GET
  • Route Optimization
    • Solve a route optimization problem
      POST
    • Submit a route optimization job
      POST
    • Retrieve solution of a route optimization job
      GET
  • Clustering
    • Solve a clustering problem
      POST
    • Submit a clustering job
      POST
    • Retrieve solution of a clustering job
      GET
  • Custom Profiles
    • Create a custom routing profile
      POST
    • List your custom routing profiles
      GET
    • Submit a profile creation job
      POST
    • Retrieve result of a profile creation job
      GET
    • Delete a custom routing profile
      DELETE
  • 数据模型
    • Schemas
      • ClusterResponse
      • Cluster
      • ClusterRequest
      • ClusterConfiguration
      • Clusters
      • ClusterCustomer
      • ClusterCustomerAddress
      • ClusterConfigurationRouting
      • ClusterConfigurationClustering
      • GeocodingResponse
      • GeocodingLocation
      • GeocodingPoint
      • MatrixRequest
      • SymmetricalMatrixRequest
      • MatrixResponse
      • RouteRequest
      • CustomModel
      • CustomModelForProfile
      • ProfileRequest
      • ProfileResponse
      • ProfileGetResponse
      • RouteResponse
      • EncodedLineString
      • BBox
      • FeatureCollection
      • RouteResponsePath
      • ResponseInfo
      • IsochroneResponse
      • IsochroneResponsePolygon
      • LineString
      • Polygon
      • GHError
      • JobId
      • BadRequest
      • ErrorMessage
      • InternalErrorMessage
      • Request
      • Vehicle
      • VehicleProfileId
      • Shift
      • Algorithm
      • Address
      • ResponseAddress
      • SnappedWaypoint
      • DriveTimeBreak
      • TimeWindowBreak
      • VehicleType
      • Service
      • Shipment
      • Pickup
      • Stop
      • TimeWindow
      • PreferredVehicle
      • Configuration
      • Optimization
      • Routing
      • Objective
      • CostMatrix
      • GroupRelation
      • JobRelation
      • Response
      • Solution
      • Detail
      • Route
      • RoutePoint
      • Activity
  1. Matrices

Compute a matrix

GET
/matrix
For N origins and M destinations, compute routes from all origins to all destinations and output
the result as a matrix of travel times and/or distances.
This includes the common cases of routes from one origin to many destinations, or from many origins to one
destination.

请求参数

Authorization
API Key
在 query 添加参数
key
示例:
key: ********************
or
Query 参数

请求示例代码

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location '/matrix?profile=undefined&point=undefined&from_point=undefined&to_point=undefined&point_hint=undefined&from_point_hint=undefined&to_point_hint=undefined&snap_prevention=undefined&curbside=undefined&from_curbside=undefined&to_curbside=undefined&out_array=undefined&fail_fast=undefined&key=%3Capi-key%3E'

返回响应

🟢200成功
application/json
Matrix API response
Headers

Bodyapplication/json

示例
{
    "distances": [
        [
            0,
            97653,
            48887
        ],
        [
            97426,
            0,
            121035
        ],
        [
            49006,
            121049,
            0
        ]
    ],
    "times": [
        [
            0,
            4197,
            2994
        ],
        [
            4192,
            0,
            6074
        ],
        [
            3006,
            6062,
            0
        ]
    ],
    "weights": [
        [
            0,
            5662.551,
            3727.147
        ],
        [
            5653.807,
            0,
            7889.653
        ],
        [
            3741.528,
            7878.365,
            0
        ]
    ],
    "info": {
        "copyrights": [
            "GraphHopper",
            "OpenStreetMap contributors"
        ]
    }
}
修改于 2025-11-25 06:18:54
上一页
Compute a matrix
下一页
Submit a matrix computation job
Built with