고도 요청 및 응답

고도 요청

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의 표준에 따라 매개변수는 앰퍼샌드 (&amp;) 문자 사용 매개변수 목록 가능한 값은 아래에 나와 있습니다.

모든 요청

  • 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 값입니다. 위도 및 경도 값은 유효한 위치와 일치해야 합니다. 행성 표면에 있습니다. 위도는 -9090이며 경도 값은 -180180 사이의 값입니다. 만약 위도 또는 경도 값이 올바르지 않으면 요청이 거부됩니다. 잘못된 요청으로 간주할 수 있습니다.

배열 내에 최대 512개의 좌표를 전달하거나 유효한 URL을 생성할 수 있습니다. 여러 좌표를 전달하는 경우 반환되는 모든 데이터의 정확도는 단일 좌표에 대한 데이터를 요청할 때보다 해상도가 낮을 수 있습니다. '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 값입니다. 위도와 경도 값은 유효한 위치로 복사됩니다. 위도는 -9090이며 경도 값은 -180180 사이의 값입니다. 만약 위도 또는 경도 값이 올바르지 않으면 요청이 거부됩니다. 잘못된 요청으로 간주할 수 있습니다.

배열 내에 최대 512개의 좌표를 전달하거나 유효한 URL을 생성할 수 있습니다. 여러 개의 좌표의 경우 반환된 데이터의 정확성은 해상도가 를 사용합니다. 512개 지점 또는 좌표 초과 'locations'에서 또는 'path' 매개변수는 INVALID_REQUEST 응답을 반환합니다.

고도 응답

각 유효한 요청에 대해 고도 서비스는 고도를 반환합니다. 알 수 있습니다.

ElevationResponse

FieldRequiredTypeDescription
required Array<ElevationResult> See ElevationResult for more information.
requiredElevationStatus See ElevationStatus for more information.
optionalstring

When the service returns a status code other than OK, there may be an additional error_message field within the response object. This field contains more detailed information about thereasons behind the given status code. This field is not always returned, and its content is subject to change.

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

FieldRequiredTypeDescription
requirednumber

The elevation of the location in meters.

requiredLatLngLiteral

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.

optionalnumber

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.

FieldRequiredTypeDescription
requirednumber

Latitude in decimal degrees

requirednumber

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>

다음 예는 콜로라도주 덴버 및 Death Valley, 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>