Compute Route Matrix 개요
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
Compute Route Matrix는 Routes API 서비스의 메서드로, HTTPS 요청을 수락하고 여러 출발지와 목적지 위치 간의 경로 행렬의 거리와 이동 시간을 반환합니다. 여러 목적지 간의 이동 시간과 거리를 최대 625개의 경로 요소를 기반으로 계산하세요.
운전 경로가 필요하신가요? 경로 안내에 관심이 있는 경우 Compute 경로 개요를 참고하세요.
이전 중인가요? Distance Matrix API (기존)에서 이전하는 경우 Routes API로 이전해야 하는 이유부터 시작하는 이전 안내를 참고하세요.
Compute Routes Matrix를 사용하는 이유
Compute Routes Matrix를 사용하면 다음과 같이 배송 일정 예약을 위한 가장 효율적인 경로를 결정할 수 있습니다.
Compute Routes Matrix로 무엇을 할 수 있나요?
Compute Route Matrix를 사용하면 여러 시작 위치와 종료 위치 간에 가능한 경로의 매트릭스를 가져올 수 있습니다. 서버 측 요청당 출발지 수를 목적지 수와 곱한 값(최대 625)으로 여러 출발지와 목적지를 지정할 수 있습니다. 전체 행렬이 계산되기 전에 응답의 요소를 스트리밍하여 응답 지연 시간을 줄일 수 있습니다.
이러한 종류의 경로 데이터를 요청하여 여러 출발지와 도착지 간에 승객, 배송 상품 또는 작업자를 가장 효율적으로 경로를 설정하는 방법을 결정할 수 있습니다.
Compute Route Matrix의 작동 방식
ComputeRouteMatrix
메서드는 요청 세부정보가 포함된 JSON 요청 본문이 있는 HTTP POST 요청을 허용합니다. 출발지 1개 이상, 도착지 2개 이상, travelMode, 반환할 필드를 지정하는 필드 마스크가 필요합니다.
예
curl -X POST -d '{
"origins": [
{
"waypoint": {
"location": {
"latLng": {
"latitude": 37.420761,
"longitude": -122.081356
}
}
}
},
{
"waypoint": {
"location": {
"latLng": {
"latitude": 37.403184,
"longitude": -122.097371
}
}
}
}
],
"destinations": [
{
"waypoint": {
"location": {
"latLng": {
"latitude": 37.420999,
"longitude": -122.086894
}
}
}
},
{
"waypoint": {
"location": {
"latLng": {
"latitude": 37.383047,
"longitude": -122.044651
}
}
}
}
],
"travelMode": "DRIVE"
}' \
-H 'Content-Type: application/json' -H 'X-Goog-Api-Key: YOUR_API_KEY' \
-H 'X-Goog-FieldMask: originIndex,destinationIndex,duration,distanceMeters,status,condition' \
'https://routes.googleapis.com/distanceMatrix/v2:computeRouteMatrix'
응답에는 모든 출발 웨이포인트와 도착 웨이포인트의 조합에 가능한 경로가 포함됩니다.
리소스
다음 표에는 Routes API Compute Route Matrix 메서드를 통해 사용할 수 있는 리소스와 반환되는 데이터가 요약되어 있습니다.
Compute Routes Matrix 사용 방법
사용 가능한 클라이언트 라이브러리
Compute Route Matrix에 사용할 수 있는 클라이언트 라이브러리의 목록은 클라이언트 라이브러리를 참고하세요.
다음 단계
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-06-20(UTC)
[null,null,["최종 업데이트: 2025-06-20(UTC)"],[],[],null,["# Compute Route Matrix Overview\n\n**European Economic Area (EEA) developers** If your billing address is in the European Economic Area, effective on 8 July 2025, the [Google Maps Platform EEA Terms of Service](https://cloud.google.com/terms/maps-platform/eea) will apply to your use of the Services. Functionality varies by region. [Learn more](/maps/comms/eea/faq).\n\nCompute Route Matrix is a method in the Routes API service that accepts\nan HTTPS request and returns distances and travel times for a matrix of routes\nbetween different origin and destination locations. Calculate travel times and\ndistances for multiple destinations for up to 625 route elements.\n\n**Need Driving Routes?** If you are interested in route directions, see\n[Compute Routes Overview](/maps/documentation/routes/compute-route-over).\n\n**Migrating?** If you are migrating from the Distance Matrix API (Legacy),\nsee migration instructions starting with\n[Why migrate to the Routes API](/maps/documentation/routes/migrate-routes-why).\n\nWhy use Compute Route Matrix\n----------------------------\n\nWith Compute Route Matrix, you can determine the most efficient\nroutes for dispatch scheduling, such as:\n\n- How best to assign a set of workers to pick up a series of packages\n\n- Determine the best warehouse from which to ship packages to their final\n destination\n\nWhat you can do with Compute Route Matrix?\n------------------------------------------\n\nWith Compute Route Matrix, you can get a matrix of possible routes\nbetween many start and end locations. You can specify multiple origins and\ndestinations per server-side request with the number of origins times the number\nof destinations up to 625. You can stream elements of the response before the\nentire matrix has been calculated, lowering response latency.\n\nYou can request these kinds of route data to determine the most efficient way to\nroute passengers, shipments, or workers between multiple origins and\ndestinations:\n\n- **Distance in kilometers or miles for a selected travel mode**\n\n- **Estimated travel time in traffic**\n\nHow Compute Route Matrix works\n------------------------------\n\nThe `ComputeRouteMatrix` method accepts an HTTP POST request with\na JSON request body that contains the request details. Required are at least one\norigin, two or more destinations, travelMode, and a field mask to specify which\nfields to return. \n\n#### Example\n\n```console\ncurl -X POST -d '{\n \"origins\": [\n {\n \"waypoint\": {\n \"location\": {\n \"latLng\": {\n \"latitude\": 37.420761,\n \"longitude\": -122.081356\n }\n }\n }\n },\n {\n \"waypoint\": {\n \"location\": {\n \"latLng\": {\n \"latitude\": 37.403184,\n \"longitude\": -122.097371\n }\n }\n }\n }\n ],\n \"destinations\": [\n {\n \"waypoint\": {\n \"location\": {\n \"latLng\": {\n \"latitude\": 37.420999,\n \"longitude\": -122.086894\n }\n }\n }\n },\n {\n \"waypoint\": {\n \"location\": {\n \"latLng\": {\n \"latitude\": 37.383047,\n \"longitude\": -122.044651\n }\n }\n }\n }\n ],\n \"travelMode\": \"DRIVE\"\n}' \\\n-H 'Content-Type: application/json' -H 'X-Goog-Api-Key: \u003cvar translate=\"no\"\u003eYOUR_API_KEY\u003c/var\u003e' \\\n-H 'X-Goog-FieldMask: originIndex,destinationIndex,duration,distanceMeters,status,condition' \\\n'https://routes.googleapis.com/distanceMatrix/v2:computeRouteMatrix'\n```\n\nThe response contains the possible routes for the combination of all origin\nand destination waypoints.\n\n### Resources\n\nThe following table summarizes the resources available through the\nRoutes API Compute Route Matrix method, along with\nthe data it returns.\n\n\u003cbr /\u003e\n\n| Data resources | Data returned | Return format |\n|-----------------------------------------------------------------------|----------------------------------------------------------------------------------|---------------|\n| [ComputeRouteMatrix](/maps/documentation/routes/compute_route_matrix) | Returns an array of routes from one origin waypoint to one destination waypoint. | JSON |\n\n\u003cbr /\u003e\n\nHow to use Compute Route Matrix\n-------------------------------\n\n|---|------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| 1 | **Get set up** | Start with [Set up your Google Cloud project](/maps/documentation/routes/cloud-setup) and complete the setup instructions that follow. |\n| 2 | **Understand how the Routes API bills** | For information, see [Usage and billing](/maps/documentation/routes/usage-and-billing). |\n| 3 | **Compute matrix of routes and review the response** | For more information, see [Get a route matrix](/maps/documentation/routes/compute_route_matrix) and [Review the route matrix response](/maps/documentation/routes/understand-rm-response). |\n\n### Available client libraries\n\nFor a list of the available client libraries for\nCompute Route Matrix, see\n[Client libraries](/maps/documentation/routes/client-libraries).\n\nWhat's next\n-----------\n\n- [Get a route matrix](/maps/documentation/routes/compute_route_matrix)\n- [Available route matrix options](/maps/documentation/routes/options-rm)\n- [Choose what information to return](/maps/documentation/routes/choose_fields-rm)\n- [Migrate from Distance Matrix API (Legacy)](/maps/documentation/routes/migrate-routes)\n- [Migrate from the Routes API preview to GA](/maps/documentation/routes/migrate-routes-preview)"]]