가장 가까운 도로
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
Roads API는 최대 100개의 독립된 좌표를 사용하여 각 지점별로 가장 가까운 도로 구간을 반환합니다. 전달된 포인트가 연속 경로의 일부일 필요는 없습니다.
순차적 GPS 포인트를 사용하는 경우 도로에 맞추기를 사용하세요.
요청
가장 가까운 도로에 대한 요청은 HTTPS를 사용하여 전송해야 하며 다음 형식을 따릅니다.
https://roads.googleapis.com/v1/nearestRoads?parameters&key=YOUR_API_KEY
Required parameters
points
The points to be snapped. The points parameter accepts a list of
latitude/longitude pairs. Separate latitude and longitude values with
commas. Separate coordinates with the pipe character: "|". For example:
points=60.170880,24.942795|60.170879,24.942796|60.170877,24.942796
.
예
다음 요청은 지정된 좌표 목록을 기반으로 도로 세그먼트 집합을 반환합니다.
URL
https://roads.googleapis.com/v1/nearestRoads
?points=60.170880%2C24.942795%7C60.170879%2C24.942796%7C60.170877%2C24.942796
&key=YOUR_API_KEY
cURL
curl -L -X GET 'https://roads.googleapis.com/v1/nearestRoads?points=60.170880%2C24.942795%7C60.170879%2C24.942796%7C60.170877%2C24.942796&key=YOUR_API_KEY'
응답
각 유효한 요청에 대해 Roads API은 요청 URL 내에 표시된 형식으로 응답을 반환합니다.
{
"snappedPoints":
[
{
"location":
{ "latitude": 60.170878428876755, "longitude": 24.94269540970182 },
"originalIndex": 0,
"placeId": "ChIJfVFHrM0LkkYRBzUQos_jR5w",
},
{
"location":
{ "latitude": 60.17087741412199, "longitude": 24.942695474405202 },
"originalIndex": 1,
"placeId": "ChIJfVFHrM0LkkYRBzUQos_jR5w",
},
{
"location":
{ "latitude": 60.170875416131736, "longitude": 24.942695601802203 },
"originalIndex": 2,
"placeId": "ChIJfVFHrM0LkkYRBzUQos_jR5w",
},
],
}
대답은 다음 스키마를 사용합니다.
NearestRoadsResponse
Field | Required | Type | Description |
---|
snappedPoints
| optional |
Array<SnappedPoint> |
An array of snapped points. Sometimes containing several snapped
points for the same point with differing placeId or location.
See SnappedPoint for more information.
|
SnappedPoint
Field | Required | Type | Description |
---|
location
| required | LatitudeLongitudeLiteral |
See
LatitudeLongitudeLiteral
for more information.
|
placeId
| required | string |
A unique identifier for a place. All place IDs returned by the Roads
API correspond to road segments.
|
originalIndex
| optional | number |
An integer that indicates the corresponding value in the original
request. Each value in the request should map to a snapped value in
the response. However, if you've set interpolate=true or if you're
using nearest roads, then it's possible that the response will
contain more coordinates than the request. Interpolated values will
not have an originalIndex . These values are indexed
from 0 , so a point with an originalIndex of
4 will be the snapped value of the 5th
latitude/longitude passed to the path parameter. Nearest Roads
points may contain several points for single coordinates with
differing location or placeId.
|
LatitudeLongitudeLiteral
An object describing a specific location with Latitude and Longitude in
decimal degrees.
Field | Required | Type | Description |
---|
latitude
| required | number | Latitude in decimal degrees |
longitude
| required | number | Longitude in decimal degrees |
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-08-31(UTC)
[null,null,["최종 업데이트: 2025-08-31(UTC)"],[[["\u003cp\u003eThe Roads API identifies the nearest road segment for up to 100 independent latitude/longitude coordinates.\u003c/p\u003e\n"],["\u003cp\u003eRequests are made via HTTPS using a specified URL structure including your API key and the desired coordinates.\u003c/p\u003e\n"],["\u003cp\u003eResponses provide a list of snapped points, each containing the location on the road, a unique place ID, and potentially the original request index.\u003c/p\u003e\n"],["\u003cp\u003eEach snapped point represents the closest road segment to the corresponding input coordinate, offering valuable road network data.\u003c/p\u003e\n"],["\u003cp\u003eUse Snap to Roads API when working with sequential GPS points, as this API focuses on individual, independent coordinates.\u003c/p\u003e\n"]]],["The Roads API receives up to 100 independent latitude/longitude coordinate pairs and identifies the closest road segment for each. Submit requests via HTTPS, including the coordinates separated by commas and pipes (e.g., `60.170880,24.942795|60.170879,24.942796`). The API returns an array of `snappedPoints`, containing each point's `location` (latitude/longitude), `placeId` (road segment identifier), and `originalIndex` (position in the request). Sequential points should be processed using `Snap to Roads` instead.\n"],null,["# Nearest Roads\n\nThe Roads API takes up to 100 independent\ncoordinates, and returns the closest road segment for each point. The points\npassed don't need to be part of a continuous path.\n\nIf you are working with sequential GPS points, use [Snap to Roads](/maps/documentation/roads/%5Bsnap%5D).\n\nRequests\n--------\n\nA request to nearest roads must be sent using HTTPS, and takes the following\nform: \n\n```scdoc\nhttps://roads.googleapis.com/v1/nearestRoads?parameters&key=YOUR_API_KEY\n```\n\n\nRequired parameters\n-------------------\n\n-\n\n ### points\n\n\n The points to be snapped. The points parameter accepts a list of\n latitude/longitude pairs. Separate latitude and longitude values with\n commas. Separate coordinates with the pipe character: \"\\|\". For example:\n `points=60.170880,24.942795|60.170879,24.942796|60.170877,24.942796`.\n\n\u003cbr /\u003e\n\nExamples\n--------\n\nThe following request returns a set of road segments based on the specified\nlist of coordinates.\n\n\u003cbr /\u003e\n\n### URL\n\n```scdoc\nhttps://roads.googleapis.com/v1/nearestRoads\n ?points=60.170880%2C24.942795%7C60.170879%2C24.942796%7C60.170877%2C24.942796\n &key=YOUR_API_KEY\n```\n\n### cURL\n\n```bash\ncurl -L -X GET 'https://roads.googleapis.com/v1/nearestRoads?points=60.170880%2C24.942795%7C60.170879%2C24.942796%7C60.170877%2C24.942796&key=YOUR_API_KEY'\n```\n\n\u003cbr /\u003e\n\nResponses\n---------\n\nFor each valid request, the Roads API will return a response in\nthe format indicated within the request URL.\n\n\n```json\n{\n \"snappedPoints\":\n [\n {\n \"location\":\n { \"latitude\": 60.170878428876755, \"longitude\": 24.94269540970182 },\n \"originalIndex\": 0,\n \"placeId\": \"ChIJfVFHrM0LkkYRBzUQos_jR5w\",\n },\n {\n \"location\":\n { \"latitude\": 60.17087741412199, \"longitude\": 24.942695474405202 },\n \"originalIndex\": 1,\n \"placeId\": \"ChIJfVFHrM0LkkYRBzUQos_jR5w\",\n },\n {\n \"location\":\n { \"latitude\": 60.170875416131736, \"longitude\": 24.942695601802203 },\n \"originalIndex\": 2,\n \"placeId\": \"ChIJfVFHrM0LkkYRBzUQos_jR5w\",\n },\n ],\n}\n```\n\n\u003cbr /\u003e\n\nThe response uses the following schema.\n\n\n### NearestRoadsResponse\n\n| Field | Required | Type | Description |\n|:---------------------|----------|-------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| #### `snappedPoints` | optional | Array\\\u003c[SnappedPoint](#SnappedPoint \"SnappedPoint\")\\\u003e | An array of snapped points. Sometimes containing several snapped points for the same point with differing placeId or location. See [SnappedPoint](#SnappedPoint) for more information. |\n\n### SnappedPoint\n\n| Field | Required | Type | Description |\n|:---------------------|--------------|----------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| #### `location` | **required** | [LatitudeLongitudeLiteral](#LatitudeLongitudeLiteral \"LatitudeLongitudeLiteral\") | See [LatitudeLongitudeLiteral](#LatitudeLongitudeLiteral \"LatitudeLongitudeLiteral\") for more information. |\n| #### `placeId` | **required** | string | A unique identifier for a place. All place IDs returned by the Roads API correspond to road segments. |\n| #### `originalIndex` | optional | number | An integer that indicates the corresponding value in the original request. Each value in the request should map to a snapped value in the response. However, if you've set interpolate=true or if you're using nearest roads, then it's possible that the response will contain more coordinates than the request. Interpolated values will not have an `originalIndex`. These values are indexed from `0`, so a point with an originalIndex of `4` will be the snapped value of the 5th latitude/longitude passed to the path parameter. Nearest Roads points may contain several points for single coordinates with differing location or placeId. |\n\n### LatitudeLongitudeLiteral\n\n\nAn object describing a specific location with Latitude and Longitude in\ndecimal degrees.\n\n| Field | Required | Type | Description |\n|:-----------------|--------------|--------|------------------------------|\n| #### `latitude` | **required** | number | Latitude in decimal degrees |\n| #### `longitude` | **required** | number | Longitude in decimal degrees |\n\n\u003cbr /\u003e"]]