이 제품 또는 기능은 기존 상태입니다. 기존 단계 및 기존 서비스에서 최신 서비스로 이전하는 방법에 대한 자세한 내용은
기존 제품 및 기능을 참고하세요.
Distance Matrix API 개요
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
소개
Distance Matrix API (기존)는 특정 교통수단의 출발지와 목적지가 포함된 HTTPS 요청을 수락하는 서비스입니다. 출발지와 목적지의 각 조합에 대해 이동 거리와 시간을 반환합니다.
Distance Matrix API를 사용해야 하는 이유
Distance Matrix API를 사용하면 가능한 여러 출발지와 목적지 간 가장 효율적인 이동 경로를 파악할 수 있습니다. 예를 들어 작업 현장에 보낼 작업자나 패키지를 보낼 창고를 선택할 수 있습니다.
Distance Matrix API로 할 수 있는 작업
Distance Matrix API를 사용하면 출발지와 목적지 행렬에 대한 이동 거리와 시간을 제공할 수 있습니다. 운전, 자전거, 대중교통, 도보와 같은 이동 수단과 버스, 지하철, 기차, 트램, 철도와 같은 대중교통 수단을 비롯한 여러 옵션을 지정할 수 있습니다.
Distance Matrix API는 시작 지점과 종료 지점 간의 추천 경로를 기반으로 정보를 제공합니다. 다음과 같은 거리 데이터를 요청할 수 있습니다.
- 선택한 이동 모드의 거리
- 거리(킬로미터 또는 마일)
- 교통 상황을 고려한 예상 이동 시간

Distance Matrix API의 작동 방식
Distance Matrix API는 원하는 수의 출발지 (시작점)와 목적지를 사용하며, 요청의 첫 번째 출발지부터 시작하여 다음 출발지로 단계적으로 진행하면서 각 출발지와 요청된 모든 목적지 간의 거리와 이동 시간을 반환합니다.
예를 들어 요청에서 A와 B를 출발지로, C와 D를 도착지로 지정하면 다음과 같은 순서로 거리와 이동 시간을 반환합니다.
다음 예는 워싱턴 DC와 보스턴이라는 두 출발지와 뉴욕시라는 단일 목적지를 JSON 형식으로 요청하는 방법을 보여줍니다.
https://maps.googleapis.com/maps/api/distancematrix/json
?destinations=New%20York%20City%2C%20NY
&origins=Washington%2C%20DC%7CBoston
&units=imperial
&key=YOUR_API_KEY
리소스
다음 표에는 Distance Matrix API를 통해 사용할 수 있는 리소스와 반환되는 데이터가 요약되어 있습니다.
데이터 리소스 |
반환된 데이터 |
반환 형식 |
거리 행렬
장소 ID, 주소 또는 위도/경도 좌표 형식으로 출발지와 도착지를 제공합니다.
|
- 각 출발지와 각 목적지 간의 거리 및 이동 시간
- 운전 모드와 출발 시간을 지정한 경우 교통 상황에서의 시간
|
|
Distance Matrix API 사용 방법
1 |
설정하기 |
Google Cloud 프로젝트 설정하기로 시작하여 이어지는 설정 안내를 완료합니다. |
2 |
거리 행렬 요청 시도하기 |
API 키가 있으면 브라우저에서 바로 Distance Matrix API를 테스트할 수 있습니다. 예시는 시작하기 가이드의 요청 샘플을 참고하세요.
|
3 |
더 복잡한 요청 작성하기 |
여러 출발지와 목적지를 제공하는 요청을 시도해 보세요. 지정된 출발 시간이나 경로 제한과 같은 계산을 제한하는 선택적 매개변수에 대해 알아봅니다. 거리 행렬 요청 및 응답 가이드의 선택적 매개변수를 참고하세요.
|
4 |
대답 기본사항 이해하기 |
데이터 응답을 살펴보고 앱에서 거리 매트릭스 데이터를 사용할 준비를 합니다. 자세한 내용은 거리 매트릭스 응답을 참고하세요.
|
5 |
자체 앱에 거리 매트릭스 데이터를 통합하세요. |
이 데이터를 사용하여 이동 거리와 시간을 계산할 수 있습니다.
|
사용 가능한 클라이언트 라이브러리
다음 클라이언트 라이브러리 중 하나를 통해 원하는 언어로 이 API를 호출합니다.
Google 지도 서비스용 Java Client, Python Client, Go Client, Node.js Client는 커뮤니티 지원 클라이언트 라이브러리로, Apache 2.0 라이선스에 따라 오픈 소스로 제공됩니다.
GitHub에서 다운로드하세요. GitHub에서는 설치 안내와 샘플 코드도 찾을 수 있습니다.
다음 단계
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-08-31(UTC)
[null,null,["최종 업데이트: 2025-08-31(UTC)"],[[["\u003cp\u003eThe Distance Matrix API calculates travel distance and time between multiple origins and destinations, supporting various modes of transport like driving, biking, transit, or walking.\u003c/p\u003e\n"],["\u003cp\u003eThis API is ideal for optimizing logistics, such as determining efficient delivery routes or assigning workers to job sites based on travel time and distance.\u003c/p\u003e\n"],["\u003cp\u003eThe API returns data in JSON or XML format, providing distance and duration information for each origin-destination pair, including traffic estimations for driving mode.\u003c/p\u003e\n"],["\u003cp\u003eWhile it doesn't provide turn-by-turn directions, you can use the Directions API for detailed route guidance between a single origin and destination.\u003c/p\u003e\n"],["\u003cp\u003eYou can access the Distance Matrix API using client libraries for Java, Python, Go, and Node.js, allowing integration with your applications for custom solutions.\u003c/p\u003e\n"]]],["The Distance Matrix API calculates travel distance and duration between multiple origins and destinations for various transport modes like driving, biking, transit, or walking. It takes an HTTPS request specifying origins and destinations and returns data for each origin-destination pair, in a step-wise fashion. Users can customize requests with parameters like transport mode, units, and departure times, to be used for travel efficiency. The service can return distance, and estimated travel time, including traffic conditions. It supports JSON and XML return format.\n"],null,["# Distance Matrix API 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\nIntroduction\n------------\n\nThe Distance Matrix API (Legacy) is a service that accepts an HTTPS request\ncontaining origins and destinations for a given mode of transport. For each\ncombination of origin and destination, it returns travel distance and duration. \n\nWhy use the Distance Matrix API\n-------------------------------\n\nYou can use the Distance Matrix API to help determine the most efficient\ntravel routes between multiple possible origins and destinations. For\nexample, which workers to send to job sites, or from which warehouses to send\npackages.\n| This API is now in [legacy\n| mode](https://developers.google.com/maps/legacy). Use [Compute Route Matrix](/maps/documentation/routes/compute-route-matrix-over) instead.\n\nWhat you can do with the Distance Matrix API\n--------------------------------------------\n\nWith the Distance Matrix API, you can provide travel distance and time for\na matrix of origins and destinations. You can specify several options, including\nmode of transportation, such as driving, biking, transit or walking, as well as\ntransit modes, such as bus, subway, train, tram, or rail.\n\nThe Distance Matrix API provides information based on the recommended route\nbetween start and end points. You can request these kinds of distance data:\n\n- Distance for a selected travel mode\n- Distance in kilometers or miles\n- Estimated travel time in traffic\n\nHow the Distance Matrix API works\n---------------------------------\n\nThe Distance Matrix API uses any number of origins (starting points) and destinations, and returns the distance and travel time between each\norigin and all requested destinations, starting with the first origin in\nthe request and proceeding step-wise to the next.\n\nFor example, if your request specifies A and B as origins, and C and D as destinations, it returns distances and travel time in this order:\n\n- A to C\n- A to D\n- B to C\n- B to D\n\nThe following example shows a request for two origins:\nWashington, DC and Boston, with a single destination, New York City, NY, in\nJSON format: \n\n```scdoc\nhttps://maps.googleapis.com/maps/api/distancematrix/json\n ?destinations=New%20York%20City%2C%20NY\n &origins=Washington%2C%20DC%7CBoston\n &units=imperial\n &key=YOUR_API_KEY\n```\n\n### Resources\n\nThe following table summarizes the resources available through the\nDistance Matrix API along with the data it returns.\n\n\u003cbr /\u003e\n\n| Data resources | Data returned | Return format |\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|---------------|\n| [Distance matrix](/maps/documentation/distance-matrix/distance-matrix) Supply origins and destinations in the form of place IDs, addresses, or latitude/longitude coordinates. | - Distance and travel time between each origin and each destination - Duration in traffic if you've specified the driving mode and a departure time | - JSON - XML |\n\n\u003cbr /\u003e\n\nHow to use the Distance Matrix API\n----------------------------------\n\n|---|---------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| 1 | **Get set up** | Start with [Set up your Google Cloud project](/maps/documentation/distance-matrix/cloud-setup) and complete the setup instructions that follow. |\n| 2 | **Try a distance matrix request** | Once you have an API key, you can start testing out the Distance Matrix API directly from your browser. See [Sample requests](/maps/documentation/distance-matrix/start#sample-request) in the *Get started* guide for examples. |\n| 3 | **Compose a more complex request** | Try a request that supplies multiple origins and destinations. Learn about optional parameters to constrain calculations, such as a specified departure time, or route restrictions. See [Optional parameters](/maps/documentation/distance-matrix/distance-matrix#optional-parameters) in the *Distance Matrix request and response* guide. |\n| 4 | **Understand response basics** | Explore the data responses to prepare to use distance matrix data for your app. See [Distance matrix responses](/maps/documentation/distance-matrix/distance-matrix#distance-matrix-responses) for details. |\n| 5 | **Incorporate distance matrix data into your own app!** | You can use this data to calculate travel distance and time. |\n\n### Available client libraries\n\nCall this API in the language of\nyour choice through one of the following client libraries:\n\n- [Java\n Client for Google Maps Services](https://github.com/googlemaps/google-maps-services-java)\n- [Python\n Client for Google Maps Services](https://github.com/googlemaps/google-maps-services-python)\n- [Go Client\n for Google Maps Services](https://github.com/googlemaps/google-maps-services-go)\n- [Node.js\n Client for Google Maps Services](https://github.com/googlemaps/google-maps-services-js)\n\nThe Java Client, Python Client, Go Client and Node.js Client for Google Maps\nServices are community-supported client libraries, open sourced under the\n[Apache 2.0 License](http://www.apache.org/licenses/LICENSE-2.0).\nDownload them from GitHub, where you can also find installation instructions and sample code.\n\nWhat's next\n-----------\n\n- **Start using the Distance Matrix** : Go to [Get Started](/maps/documentation/distance-matrix/start).\n- **Get started with sample requests and responses** : Go to [Distance Matrix\n request and response](/maps/documentation/distance-matrix/distance-matrix).\n- **Follow best practices** : Go to [Web Service Best\n Practices](/maps/documentation/distance-matrix/web-service-best-practices)."]]