Elevation API 總覽
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
Elevation API 服務可傳回
,或是對路徑沿途的海拔高度資料進行取樣。
使用 Elevation API 的好處
您可以運用 Elevation API 開發應用程式,以支援
進行高度敏感活動、定位應用程式,或進行低問卷調查的客戶
含有路線沿途高度和高度變化的應用程式。例如:
就能提供海拔增減資料,強化運動應用程式,提升運動效能,例如
像是健行、騎腳踏車或水肺潛水
Elevation API 的功能
使用 Elevation API,您就能將海拔高度資料
或地圖。例如:
- 取得特定地點的海拔高度。
- 計算路線上或二者之間的差
點。
Elevation API 的運作方式
Elevation API 接受以經緯度座標編碼網址的要求
可做為獨立位置,或以路徑沿途的一系列地點的形式提供。這個要求
例如,以 JSON 格式指定丹佛 (Denver) 中心的海拔高度查詢。
https://maps.googleapis.com/maps/api/elevation/json
?locations=39.7391536%2C-104.9847034
&key=YOUR_API_KEY
服務會取得所提供座標的海拔高度。此外,這個公式也會
沒有海拔高度的地點高度,提供從四個地方傳回的平均值。
最接近提供海拔高度資料的最接近地點最後,它會決定
地點的解析度。
資源
下表摘要列出透過
Elevation API 以及其傳回的資料。
資料資源 |
傳回的資料 |
退貨格式 |
經緯度座標
您可以從一或多個地點提供資料,也可以用路徑沿途的系列資料的形式提供資料。個人中心
也可以提供編碼的座標。最多可傳遞 512 個座標。
|
Elevation API 會提供以公尺為單位的高度相對的
至局部平均海平面 (LMSL)。海拔高度可視為正數傳回
或負值,方法如下:
- 正值表示學習管理系統 (LMS) 以上的位置。
包括表面位置或高海拔湖泊的底部
- 負值表示低於 LMSL 的位置,包括
放在平面或洋底上的位置
- Resolution 會指出資料點與
以公尺為單位
|
|
如何使用 Elevation API
1 |
做好準備: |
首先,請設定您的
Google Cloud 專案
然後完成設定
並按照指示操作 |
2 |
嘗試提高海拔高度要求 |
取得 API 金鑰後,您可以直接透過
您的瀏覽器。請參閱要求範例
詳情請參閱入門指南。
|
3 |
撰寫較複雜的要求 |
專案設定完成後,請試試同時提供位置資料的要求
路徑。請參閱指定路徑。
。
|
4 |
瞭解回覆的基本概念 |
探索海拔高度資料回應,為您的應用程式使用海拔高度資料。詳情請見
海拔高度回應
。
|
5 |
將海拔高度資料加入自己的應用程式! |
您可以使用海拔高度資料,改善以位置資訊為基礎的應用程式,例如運動應用程式
活動或問卷調查資料
|
可用的用戶端程式庫
如要呼叫這個 API,請使用
從以下用戶端程式庫中擇一:
Google 地圖適用的 Java 用戶端、Python 用戶端、Go 用戶端和 Node.js 用戶端
服務是社群支援的用戶端程式庫,並採用
Apache 2.0 授權。
您可以從 GitHub 下載這些範例,也可以在其中找到安裝操作說明和程式碼範例。
後續步驟
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-31 (世界標準時間)。
[null,null,["上次更新時間:2025-08-31 (世界標準時間)。"],[[["\u003cp\u003eThe Elevation API provides elevation data for locations on Earth, enabling applications with elevation-sensitive features.\u003c/p\u003e\n"],["\u003cp\u003eYou can retrieve elevation for single points or calculate elevation differences along paths, useful for activities like hiking or biking.\u003c/p\u003e\n"],["\u003cp\u003eThe API accepts latitude/longitude coordinates and returns elevation data in meters relative to local mean sea level, with resolution information.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can access the Elevation API through various client libraries (Java, Python, Go, Node.js) and integrate it into their applications.\u003c/p\u003e\n"],["\u003cp\u003eTo get started, set up a Google Cloud project, try sample requests, and explore the documentation for detailed usage instructions.\u003c/p\u003e\n"]]],[],null,["The Elevation API is a service that returns elevation data for\na location on the earth, or sampled elevation data along paths.\n\nWhy use the Elevation API\n\nWith the Elevation API, you can develop applications to support your\ncustomers with elevation-sensitive activities, positioning applications, or low-surveying\napplications that include elevations and elevation changes along routes. For example,\nyou can provide elevation gain and loss data to enhance a sports application for activities such\nas hiking, biking, or scuba diving.\n\nWhat you can do with the Elevation API\n\nWith the Elevation API, you can include elevation data in your\napplications or on a map. For example:\n\n- Get the **elevation** for a particular place.\n- Calculate the **differences** in elevation along a route or between two points.\n\nHow the Elevation API works The Elevation API accepts a request as an encoded URL with latitude/longitude coordinates provided as either discrete locations, or as a series of locations along a path. This request, for example, queries elevation for the center of Denver, Colorado, specifying a return in JSON format. \n\n```scdoc\n https://maps.googleapis.com/maps/api/elevation/json\n ?locations=39.7391536%2C-104.9847034\n &key=YOUR_API_KEY\n```\n\nThe service derives the elevation for the provided coordinates. It also interpolates\nelevation for a location without elevation, providing an average returned from the four\nnearest locations that do provide elevation data. Finally, it determines the overall\nresolution for the location.\n\nResources\n\nThe following table summarizes the resources available through the\nElevation API along with the data it returns.\n\n| Data resources | Data returned | Return format |\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|\n| **Latitude/longitude coordinates** You can provide data as a set of one or more locations, or as a series along a path. You can also provide encoded coordinates. Pass up to 512 coordinates. | The Elevation API provides **elevation in meters** relative to the **local mean sea level** (LMSL). Elevation can be returned as positive or negative values as indicated below: - **Positive values** indicate locations above LMSL, including surface locations or the bottom of high-altitude lakes. - **Negative values** indicate locations that are below LMSL, including locations on the surface or the ocean floor. - **Resolution** indicates the distance between the data point and the elevation, in meters. | - JSON - XML |\n\nHow to use the Elevation API\n\n|---|---------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| 1 | **Get set up.** | Start with [Set up your Google Cloud project](/maps/documentation/elevation/cloud-setup) and complete the setup instructions that follow. |\n| 2 | **Try an elevation request** | Once you have an API key, you can start testing out the Elevation API directly from your browser. See [Sample requests](/maps/documentation/elevation/start#sample-request) in the *Getting started* guide for details. |\n| 3 | **Compose a more complex request** | Once you are set up with a project, try a request that supplies a location data along a path. See [Specifying paths](/maps/documentation/elevation/requests-elevation#Paths) for details. |\n| 4 | **Understand response basics** | Explore the elevation data responses to prepare to use elevation data for your app. See [Elevation responses](/maps/documentation/elevation/requests-elevation#ElevationResponses) for details. |\n| 5 | **Incorporate elevation data into your own app!** | You can use elevation data to enhance location-based apps, such as apps for sports activities or for survey data. |\n\nAvailable 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- **Start using the Elevation API** : Go to [Set up your\n Google Cloud project](/maps/documentation/elevation/cloud-setup).\n- **Try getting path-based elevation data** : Go to [Specifying paths](/maps/documentation/elevation/requests-elevation#Paths)\n- **Follow best practices** : Go to [Web Service\n Best Practices](/maps/documentation/elevation/web-service-best-practices)."]]