Tổng quan về Elevation API
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
API độ cao là dịch vụ trả về dữ liệu độ cao cho
một vị trí trên trái đất hoặc dữ liệu độ cao được lấy mẫu dọc theo các đường dẫn.
Lý do sử dụng API nâng cao
Với API nâng cao, bạn có thể phát triển các ứng dụng để hỗ trợ
khách hàng có các hoạt động nhạy cảm với độ cao, ứng dụng định vị hoặc khảo sát thấp
các ứng dụng bao gồm độ cao và sự thay đổi cao độ dọc theo tuyến đường. Ví dụ:
bạn có thể cung cấp dữ liệu tăng và giảm độ cao để cải thiện ứng dụng thể thao cho các hoạt động như
như đi bộ đường dài, đạp xe hoặc lặn có bình dưỡng khí.
Những việc bạn có thể làm với API Độ cao
Với API Độ cao, bạn có thể đưa dữ liệu độ cao vào
hoặc trên bản đồ. Ví dụ:
- Nhận độ cao cho một địa điểm cụ thể.
- Tính những điểm khác biệt về độ cao dọc theo một tuyến đường hoặc giữa hai tuyến đường
.
Cách hoạt động của API Độ cao
API Độ cao chấp nhận yêu cầu dưới dạng URL được mã hoá có toạ độ vĩ độ/kinh độ
được cung cấp dưới dạng các vị trí riêng biệt hoặc dưới dạng một loạt vị trí dọc theo một đường dẫn. Yêu cầu này,
ví dụ: độ cao truy vấn cho trung tâm Denver, Colorado, chỉ định giá trị trả về ở định dạng JSON.
https://maps.googleapis.com/maps/api/elevation/json
?locations=39.7391536%2C-104.9847034
&key=YOUR_API_KEY
Dịch vụ lấy độ cao cho toạ độ đã cung cấp. Hàm này cũng nội suy
độ cao cho một vị trí không có độ cao, cung cấp giá trị trung bình được trả về từ bốn độ cao
các vị trí gần nhất cung cấp dữ liệu độ cao. Cuối cùng, quy tắc này xác định tổng thể
độ phân giải cho vị trí đó.
Tài nguyên
Bảng sau đây tóm tắt các tài nguyên có sẵn thông qua
API Độ cao cùng với dữ liệu mà API trả về.
Tài nguyên dữ liệu |
Dữ liệu được trả về |
Định dạng trả về |
Vĩ độ/kinh độ
Bạn có thể cung cấp dữ liệu dưới dạng một hoặc nhiều vị trí hoặc theo một chuỗi dọc theo một đường dẫn. Bạn
cũng có thể cung cấp toạ độ được mã hoá. Truyền lên tới 512 toạ độ.
|
API Độ cao cung cấp độ cao tính theo mét tương đối
đến mực nước biển trung bình tại địa phương (LMSL). Độ cao có thể được trả về dưới dạng giá trị dương
hoặc giá trị âm như được chỉ ra dưới đây:
- Giá trị dương cho biết vị trí trên LMSL,
bao gồm cả vị trí trên bề mặt hoặc đáy của các hồ có độ cao lớn.
- Giá trị âm cho biết các vị trí thấp hơn LMSL, bao gồm
trên bề mặt hoặc đáy đại dương.
- Độ phân giải cho biết khoảng cách giữa điểm dữ liệu và
cao độ, tính bằng mét.
|
|
Cách sử dụng API Độ cao
1 |
Thiết lập. |
Hãy bắt đầu bằng việc Thiết lập
Dự án trên Google Cloud
và hoàn tất quá trình thiết lập
tiếp theo. |
2 |
Thử yêu cầu về độ cao |
Sau khi có khoá API, bạn có thể bắt đầu thử nghiệm API Độ cao trực tiếp từ
trình duyệt của bạn. Hãy xem phần Yêu cầu mẫu
trong hướng dẫn Bắt đầu để biết thông tin chi tiết.
|
3 |
Soạn một yêu cầu phức tạp hơn |
Sau khi thiết lập một dự án, hãy thử yêu cầu cung cấp dữ liệu vị trí cùng
đường dẫn. Xem phần Chỉ định đường dẫn
để biết thông tin chi tiết.
|
4 |
Tìm hiểu thông tin cơ bản về câu trả lời |
Khám phá phản hồi dữ liệu độ cao để chuẩn bị sử dụng dữ liệu độ cao cho ứng dụng của bạn. Xem
Phản hồi của độ cao
để biết thông tin chi tiết.
|
5 |
Tích hợp dữ liệu độ cao vào ứng dụng của riêng bạn! |
Bạn có thể sử dụng dữ liệu độ cao để cải thiện các ứng dụng dựa trên vị trí, chẳng hạn như ứng dụng thể thao
hoặc cho dữ liệu khảo sát.
|
Thư viện ứng dụng hiện có
Gọi API này bằng ngôn ngữ của
thông qua một trong các thư viện ứng dụng sau đây:
Ứng dụng Java, Ứng dụng Python, Ứng dụng Go và Ứng dụng Node.js cho Google Maps
Các dịch vụ là thư viện ứng dụng được cộng đồng hỗ trợ, nguồn mở theo
Giấy phép Apache 2.0.
Tải các tệp đó xuống từ GitHub, nơi bạn cũng có thể tìm thấy hướng dẫn cài đặt và mã mẫu.
Các bước tiếp theo
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-08-31 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-08-31 UTC."],[[["\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)."]]