Elevation API 概览
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Google Elevation API 是一项服务,可为以下各项返回海拔数据:
地球上的某个位置,或沿路径的采样海拔数据。
为什么要使用 Elevation API
您可以使用 Google Elevation API 开发应用,以支持
具有高度敏感性活动、定位应用或进行低测量的客户
包含海拔高度和沿路线海拔变化的应用。例如:
您可以提供海拔增益数据来增强体育应用程序对于诸如此类的活动
例如远足、骑行或水肺潜水
Elevation API 的用途
利用 Google Elevation API,您可以将海拔数据添加到
或地图上。例如:
- 获取特定地点的海拔。
- 计算路线沿途的海拔高度或两者之间的海拔高度差异
积分。
Elevation API 的工作原理
Elevation API 接受将请求作为具有纬度/经度坐标的编码网址
可以作为离散位置提供,也可以作为路径沿线的一系列位置提供。此请求
例如,查询科罗拉多州丹佛市中心的海拔,以 JSON 格式指定返回值。
https://maps.googleapis.com/maps/api/elevation/json
?locations=39.7391536%2C-104.9847034
&key=YOUR_API_KEY
该服务会推导所提供坐标的海拔。它也会
位置,提供从四个参数的
提供海拔数据的最近地点。最后,它决定着
位置的分辨率。
资源
下表总结了
Elevation API 及其返回的数据。
数据资源 |
返回的数据 |
返回格式 |
经纬度坐标
您可以提供包含一个或多个位置的集合,也可以提供沿路径的一系列数据。您
还可以提供编码坐标。最多可传递 512 个坐标。
|
Elevation API 提供以米为单位的海拔高度,
本地平均海平面 (LMSL)。海拔可作为正值返回
或负值(如下所示):
- 正值表示高于 LMSL 的位置,
包括表层位置或高海拔湖泊的底部。
- 负值表示低于 LMSL 的地理位置,包括
或海底的位置。
- 分辨率表示数据点与
高度(以米为单位)。
|
|
如何使用 Elevation API
1 |
开始设置。 |
请先设置
Google Cloud 项目
并完成相关设置
按钮。 |
2 |
尝试海拔请求 |
有了 API 密钥后,您就可以直接从
。请参阅示例请求
如需了解详情,请参阅入门指南。
|
3 |
编写更复杂的请求 |
设置完项目后,请尝试请求在
路径。请参阅指定路径
了解详情。
|
4 |
了解响应基础知识 |
探索海拔数据响应,以便为应用使用海拔数据做好准备。请参阅
海拔响应
了解详情。
|
5 |
将海拔数据整合到您自己的应用中! |
您可以使用海拔数据改进基于位置的应用,例如体育类应用
或调查数据。
|
可用的客户端库
使用以下语言调用此 API:
供您选择。
适用于 Google 地图的 Java 客户端、Python 客户端、Go 客户端和 Node.js 客户端
服务是社区支持的客户端库,已按照
Apache 2.0 许可。
您可以从 GitHub 下载它们,您还可以在 GitHub 上找到安装说明和示例代码。
后续步骤
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-31。
[null,null,["最后更新时间 (UTC):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)."]]