고도 요청
Elevation API 요청은 URL 문자열로 구성됩니다. API 는 지구상의 위치에 대한 고도 데이터를 반환합니다. 다음 두 가지 방법 중 하나로 위치 데이터를 지정할 수 있습니다.
- 하나 이상의
locations
집합으로. path
를 따라 연결된 일련의 점으로
각 방법에서는 위도/경도 좌표를 사용하여 위치 또는 경로 교점을 식별합니다. 이 문서에서는 Elevation API URL의 필수 형식과 사용 가능한 매개변수에 대해 설명합니다.
Elevation API는 가장 정확도가 높은 단일 지점 쿼리에 대해 데이터를 반환합니다. 여러 위치가 포함된 일괄 쿼리 특히 위치가 분산되어 있는 경우 정확성이 낮은 데이터를 반환할 수 있습니다. 데이터가 약간 평활화될 때입니다.
Elevation API 요청의 형식은 다음과 같습니다.
https://maps.googleapis.com/maps/api/elevation/outputFormat?parameters
여기서 outputFormat
는 다음 값 중 하나일 수 있습니다.
json
(권장): 출력을 나타냅니다. JavaScript Object Notation (JSON) 또는xml
: 출력을 XML 형식으로 나타내며 노드<ElevationResponse>
개
참고: URL은 잘 인코딩되지 않은 모든 웹 서비스에서 16,384자(영문 기준)로 제한됩니다. URL을 구성할 때 이 한도에 유의해야 합니다. 여러 브라우저, 서버의 URL 글자 수 제한은 다를 수 있습니다.
HTTPS는 API 키를 사용하는 요청에 필요합니다.
요청 매개변수
Elevation API에 대한 요청은 다양한 매개변수를 사용함 요청이 개별 위치에 대한 것인지 또는 순서가 지정된 경로입니다. 불연속 위치의 경우 고도 요청은 반환 요청에서 전달된 특정 위치에 대한 데이터 경로 고도 요청은 지정된 경로를 따라 샘플링됩니다.
모든 URL의 표준에 따라 매개변수가 구분되어 있습니다.
앰퍼샌드 (&
) 문자 사용 매개변수 및 가능한 값 목록은 아래와 같습니다.
모든 요청
key
: (필수) 애플리케이션의 API 키입니다. 이 키는 할당량 관리를 위해 애플리케이션을 식별합니다. 키를 가져오는 방법을 알아보세요.
위치 요청
locations
(필수)는 고도 데이터를 반환할 지구상의 위치를 정의합니다. 이 매개변수는 쉼표로 구분된 {위도,경도} 쌍으로 표시된 단일 위치 (예: '40.714728,-73.998672') 또는 여러 위도/경도 쌍 배열 또는 인코딩된 폴리라인으로 전달됩니다. 512포인트로 제한됩니다. 사용할 수 있습니다. 자세한 내용은 아래의 위치 지정을 참조하세요.
샘플링된 경로 요청
path
(필수)는 고도 데이터를 반환할 지구상의 경로를 정의합니다. 이 매개변수는 둘 이상의 정렬된 {위도, 경도} 쌍을 정의하여, 지표면을 따라 경로를 정의합니다. 이 매개변수는samples
와 함께 사용해야 합니다. 매개변수에 대해 자세히 알아보세요. 512포인트로 제한됩니다. 지정할 수 있습니다. 자세한 내용은 아래의 경로 지정을 참고하세요.samples
(필수)은 샘플 수를 지정합니다. 고도 데이터를 반환할 경로에 있는 점입니다. 이samples
매개변수가 지정된path
를 나눕니다. 경로를 따라 순서가 지정된 등거리 지점의 집합으로 변환됩니다.
위치 지정
위치 요청은 locations
매개변수를 사용하여 나타나며, 위도/경도 값으로 전달된 구체적 위치에 대해 고도를 요청합니다.
locations
매개변수는 다음 인수를 취할 수 있습니다.
- 단일 좌표:
locations=40.714728,-73.998672
- 파이프('
|
') 문자로 구분된 좌표 배열:locations=40.714728,-73.998672|-34.397,150.644
- 인코딩된 폴리라인 알고리즘을 사용하여 인코딩된 좌표 집합:
locations=enc:gfo}EtohhU
위도와 경도 좌표 문자열은 숫자를 사용하여 정의됩니다.
를 포함해야 합니다. 예: '40.714728,-73.998672'
유효한 locations
값입니다. 위도 및
경도 값은 유효한 위치와 일치해야 합니다.
행성 표면에 있습니다. 위도는
-90
및 90
이며 경도 값은
-180
과 180
사이의 값입니다. 잘못된 위도 또는 경도 값을 지정하면 잘못된 요청으로 요청이 거부됩니다.
올바른 URL을 구성하는 한은, 배열 또는 인코딩된 폴리라인 내에 최대 512개의 좌표를 전달할 수 있습니다.
여러 좌표를 전달하는 경우 반환되는 데이터의 정확도가 단일 좌표에 대해 데이터를 요청할 때보다 낮을 수도 있습니다.
'locations'에서 512개 지점 또는 좌표를 초과함 또는 'path' 매개변수는
INVALID_REQUEST
응답입니다.
경로 지정
샘플링된 경로 요청은 path
및 samples
매개변수를 사용하여 나타나며, 경로상의 지정된 간격마다 고도 데이터를 요청합니다.
locations
매개변수, path
매개변수는 다음을 지정합니다.
위도 및 경도 값의 집합입니다. 그러나 위치 요청과 달리
path
는 순서가 지정된 꼭짓점 집합을 지정합니다. 복구를 위해
고도 데이터만 샘플링되며, 경로 요청은
samples
수에 따른 경로 길이
지정할 수 있습니다 (엔드포인트 포함).
path
매개변수는 다음 중 하나를 사용할 수 있습니다.
인수:
- 파이프(
|
) 문자로 구분되고 쉼표로 구분된 둘 이상의 좌표 텍스트 문자열 배열:path=40.714728,-73.998672|-34.397,150.644
- 인코딩된 폴리라인 알고리즘을 사용하여 인코딩된 좌표:
path=enc:gfo}EtohhUxD@bAxJmGF
위도와 경도 좌표 문자열은 숫자를 사용하여 정의됩니다.
를 포함해야 합니다. 예를 들어
'40.714728,-73.998672|-34.397, 150.644' 은(는) 유효한 입니다.
path
값입니다. 위도와 경도 값은
유효한 위치로 복사됩니다. 위도는 -90
과 90
사이의 임의 값을 취할 수 있으며, 경도는 -180
과 180
사이의 임의 값을 취할 수 있습니다. 잘못된 위도 또는 경도 값을 지정하면 잘못된 요청으로 요청이 거부됩니다.
올바른 URL을 구성하는 한은, 배열 또는 인코딩된 폴리라인 내에 최대 512개의 좌표를 전달할 수 있습니다. 여러 개의
좌표의 경우 반환된 데이터의 정확성은 해상도가
를 사용합니다. 512개 지점 또는 좌표 초과
'locations'에서 또는 'path' 매개변수는 INVALID_REQUEST
응답을 반환합니다.
고도 응답
각 유효한 요청에 대해 고도 서비스는 고도를 반환합니다. 알 수 있습니다.
ElevationResponse
Field | Required | Type | Description |
---|---|---|---|
| required | Array<ElevationResult> | See ElevationResult for more information. |
| required | ElevationStatus | See ElevationStatus for more information. |
| optional | string |
When the service returns a status code other than |
ElevationStatus
Status codes returned by service.
OK
indicating the API request was successful.DATA_NOT_AVAILABLE
indicating that there's no available data for the input locations.INVALID_REQUEST
indicating the API request was malformed.OVER_DAILY_LIMIT
indicating any of the following:- The API key is missing or invalid.
- Billing has not been enabled on your account.
- A self-imposed usage cap has been exceeded.
- The provided method of payment is no longer valid (for example, a credit card has expired).
OVER_QUERY_LIMIT
indicating the requestor has exceeded quota.REQUEST_DENIED
indicating the API did not complete the request.UNKNOWN_ERROR
indicating an unknown error.
상태 코드가 OK
이외인 경우, 고도 응답 객체 내에 추가 error_message
필드가 있을 수 있습니다. 이 필드에는 지정된 상태 코드가 제시된 이유에 대한 상세정보가 포함되어 있습니다.
응답에는 다음 요소가 있는 results
배열이 포함됩니다.
ElevationResult
Field | Required | Type | Description |
---|---|---|---|
| required | number | The elevation of the location in meters. |
| required | LatLngLiteral | A location element of the position for which elevation data is being computed. Note that for path requests, the set of location elements will contain the sampled points along the path. See LatLngLiteral for more information. |
| optional | number | The value indicating the maximum distance between data points from which the elevation was interpolated, in meters. This property will be missing if the resolution is not known. Note that elevation data becomes more coarse (larger resolution values) when multiple points are passed. To obtain the most accurate elevation value for a point, it should be queried independently. |
location
객체에는 다음 요소가 있습니다.
LatLngLiteral
An object describing a specific location with Latitude and Longitude in decimal degrees.
Field | Required | Type | Description |
---|---|---|---|
| required | number | Latitude in decimal degrees |
| required | number | Longitude in decimal degrees |
위치 고도 예시
다음 예시에서는 콜로라도 덴버 '마일 하이 시티'의 고도를 JSON 형식으로 요청합니다.
URL
https://maps.googleapis.com/maps/api/elevation/json ?locations=39.7391536%2C-104.9847034 &key=YOUR_API_KEY
cURL
curl -L -X GET 'https://maps.googleapis.com/maps/api/elevation/json?locations=39.7391536%2C-104.9847034&key=YOUR_API_KEY'
JSON
{ "results": [ { "elevation": 1608.637939453125, "location": { "lat": 39.7391536, "lng": -104.9847034 }, "resolution": 4.771975994110107, }, ], "status": "OK", }
XML
<ElevationResponse> <status>OK</status> <result> <location> <lat>39.7391536</lat> <lng>-104.9847034</lng> </location> <elevation>1608.6379395</elevation> <resolution>4.7719760</resolution> </result> </ElevationResponse>
다음 예에서는 여러 개의 응답을 보여줍니다(CO 덴버 및 CA 데스밸리).
이 요청은 JSON output
플래그를 사용하는 방법을 보여줍니다.
URL
https://maps.googleapis.com/maps/api/elevation/json ?locations=39.7391536%2C-104.9847034%7C36.455556%2C-116.866667 &key=YOUR_API_KEY
cURL
curl -L -X GET 'https://maps.googleapis.com/maps/api/elevation/json?locations=39.7391536%2C-104.9847034%7C36.455556%2C-116.866667&key=YOUR_API_KEY'
이 요청은 XML output
플래그 사용을 보여줍니다.
https://maps.googleapis.com/maps/api/elevation/xml?locations=39.7391536,-104.9847034|36.455556,-116.866667&key=YOUR_API_KEY
아래 탭을 선택하여 샘플 JSON 및 XML 응답을 확인하세요.
JSON
{ "results": [ { "elevation": 1608.637939453125, "location": { "lat": 39.7391536, "lng": -104.9847034 }, "resolution": 4.771975994110107, }, { "elevation": -52.79492568969727, "location": { "lat": 36.455556, "lng": -116.866667 }, "resolution": 19.08790397644043, }, ], "status": "OK", }
XML
<ElevationResponse> <status>OK</status> <result> <location> <lat>39.7391536</lat> <lng>-104.9847034</lng> </location> <elevation>1608.6379395</elevation> <resolution>4.7719760</resolution> </result> <result> <location> <lat>36.4555560</lat> <lng>-116.8666670</lng> </location> <elevation>-52.7949257</elevation> <resolution>19.0879040</resolution> </result> </ElevationResponse>
다음 예시에서는 미국 대륙에서 가장 높은 지점과 가장 낮은 지점인 path
캘리포니아 휘트니 산에서 캘리포니아 배드워터까지의 직선을 따라 고도 데이터를 요청합니다. 우리는 세 가지
samples
에 두 개의 엔드포인트와
있습니다.
URL
https://maps.googleapis.com/maps/api/elevation/json ?path=36.578581%2C-118.291994%7C36.23998%2C-116.83171 &samples=3 &key=YOUR_API_KEY
cURL
curl -L -X GET 'https://maps.googleapis.com/maps/api/elevation/json?path=36.578581%2C-118.291994%7C36.23998%2C-116.83171&samples=3&key=YOUR_API_KEY'
JSON
{ "results": [ { "elevation": 4411.94189453125, "location": { "lat": 36.578581, "lng": -118.291994 }, "resolution": 19.08790397644043, }, { "elevation": 1372.8359375, "location": { "lat": 36.41150289067028, "lng": -117.5602607523847 }, "resolution": 9.543951988220215, }, { "elevation": -84.51690673828125, "location": { "lat": 36.23998, "lng": -116.83171 }, "resolution": 9.543951988220215, }, ], "status": "OK", }
XML
<ElevationResponse> <status>OK</status> <result> <location> <lat>36.5785810</lat> <lng>-118.2919940</lng> </location> <elevation>4411.9418945</elevation> <resolution>19.0879040</resolution> </result> <result> <location> <lat>36.4115029</lat> <lng>-117.5602608</lng> </location> <elevation>1372.8359375</elevation> <resolution>9.5439520</resolution> </result> <result> <location> <lat>36.2399800</lat> <lng>-116.8317100</lng> </location> <elevation>-84.5169067</elevation> <resolution>9.5439520</resolution> </result> </ElevationResponse>