ภาพรวมของ Elevation API
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
Elevation API คือบริการที่แสดงผลข้อมูลระดับความสูงสําหรับ
ตำแหน่งบนพื้นโลก หรือข้อมูลการยกตัวอย่างจากเส้นทาง
เหตุผลที่ควรใช้ Elevation API
เมื่อใช้ Elevation API คุณสามารถพัฒนาแอปพลิเคชันเพื่อสนับสนุน
ลูกค้าที่มีกิจกรรมที่ไวต่อระดับความสูง แอปพลิเคชันระบุตำแหน่ง หรือการสำรวจระดับต่ำ
แอปพลิเคชันที่รวมการยกระดับและการเปลี่ยนแปลงระดับความสูงตลอดเส้นทาง ตัวอย่างเช่น
คุณสามารถให้ข้อมูลความสูงสะสมและการสูญเสียเพื่อปรับปรุงแอปพลิเคชันกีฬาสำหรับกิจกรรมต่างๆ เช่น
เช่น เดินเขา ปั่นจักรยาน หรือดำน้ำลึก
สิ่งที่คุณทำได้ด้วย Elevation API
ด้วย API ระดับความสูง คุณสามารถรวมข้อมูลระดับความสูงไว้ใน
แอปพลิเคชัน หรือบนแผนที่ เช่น
- ดูระดับความสูงของสถานที่ที่เจาะจง
- คำนวณความแตกต่างของระดับความสูงตามเส้นทางหรือระหว่าง 2
คะแนน
วิธีการทำงานของ Elevation API
Elevation API จะยอมรับคำขอเป็น URL ที่เข้ารหัสโดยมีพิกัดละติจูด/ลองจิจูด
แสดงเป็นสถานที่ที่แยกจากกัน หรือเป็นชุดตำแหน่งตลอดเส้นทาง คำขอนี้
ตัวอย่างเช่น ระดับความสูงของการค้นหาสำหรับใจกลางเมืองเดนเวอร์ รัฐโคโลราโด ที่ระบุการแสดงผลในรูปแบบ JSON
https://maps.googleapis.com/maps/api/elevation/json
?locations=39.7391536%2C-104.9847034
&key=YOUR_API_KEY
บริการรับรู้ระดับความสูงสำหรับพิกัดที่ระบุ และยังช่วยประมาณค่า
ระดับความสูงสำหรับสถานที่ตั้งที่ไม่มีระดับความสูง ซึ่งแสดงค่าเฉลี่ยที่ส่งคืนจากสี่
สถานที่ใกล้เคียงที่สุดที่ให้ข้อมูลระดับความสูง สุดท้าย โมเดลจะตัดสิน
ความละเอียดของสถานที่นั้น
แหล่งข้อมูล
ตารางต่อไปนี้สรุปแหล่งข้อมูลที่มีให้ผ่าน
Elevation API และข้อมูลที่ส่งกลับมา
แหล่งข้อมูล |
ข้อมูลที่ส่งคืน |
รูปแบบการคืนสินค้า |
พิกัดละติจูด/ลองจิจูด
คุณสามารถให้ข้อมูลเป็นชุดของตำแหน่งอย่างน้อย 1 แห่ง หรือเป็นชุดตามเส้นทางก็ได้ คุณ
ก็สามารถให้พิกัดที่เข้ารหัสได้ ส่งผ่านได้ถึง 512 พิกัด
|
Elevation API จะแสดงระดับความสูงเป็นเมตรซึ่งสัมพันธ์กับ
ตามระดับน้ำทะเลเฉลี่ยในท้องถิ่น (LMSL) แสดงผลระดับความสูงเป็นบวกได้
หรือค่าติดลบตามที่ระบุไว้ด้านล่าง
- ค่าบวกจะระบุสถานที่อยู่เหนือ LMSL
รวมถึงตำแหน่งผิวน้ำหรือก้นทะเลสาบบนที่สูง
- ค่าลบระบุสถานที่ที่ต่ำกว่า LMSL รวมถึง
ตำแหน่งบนพื้นผิวหรือก้นมหาสมุทร
- ความละเอียดจะระบุระยะห่างระหว่างจุดข้อมูลและ
ระดับความสูงในหน่วยเมตร
|
|
วิธีใช้ Elevation API
1 |
เตรียมตัวให้พร้อม |
เริ่มต้นด้วยตั้งค่า
โปรเจ็กต์ Google Cloud
และตั้งค่าให้เสร็จสมบูรณ์
คำแนะนำที่ตามมา |
2 |
ลองส่งคำขอยกระดับ |
เมื่อมีคีย์ API แล้ว คุณจะเริ่มทดสอบ Elevation API ได้โดยตรงจาก
เบราว์เซอร์ของคุณ ดูคำขอตัวอย่าง
ในคู่มือเริ่มต้นใช้งานเพื่อดูรายละเอียด
|
3 |
เขียนคําขอที่ซับซ้อนมากขึ้น |
เมื่อตั้งค่าโปรเจ็กต์แล้ว ให้ลองขอให้ส่งข้อมูลตำแหน่ง
เส้นทาง ดูการระบุเส้นทาง
เพื่อดูรายละเอียด
|
4 |
ทำความเข้าใจพื้นฐานคำตอบ |
ดูการตอบสนองของข้อมูลระดับความสูงเพื่อเตรียมใช้ข้อมูลระดับความสูงสำหรับแอปของคุณ โปรดดู
คำตอบการยกระดับ
เพื่อดูรายละเอียด
|
5 |
รวมข้อมูลระดับความสูงลงในแอปของคุณ |
คุณสามารถใช้ข้อมูลระดับความสูงเพื่อเพิ่มประสิทธิภาพให้กับแอปที่อิงตามตำแหน่ง เช่น แอปสำหรับกีฬา
กิจกรรมหรือสำหรับข้อมูลแบบสำรวจ
|
ไลบรารีของไคลเอ็นต์ที่ใช้ได้
เรียกใช้ API นี้ในภาษา
ที่คุณเลือกผ่านไลบรารีไคลเอ็นต์รายการใดรายการหนึ่งต่อไปนี้
Java Client, Python Client, Go Client และ Node.js สำหรับ Google Maps
บริการต่างๆ เป็นไลบรารีไคลเอ็นต์ที่สนับสนุนโดยชุมชน โดยเป็นโอเพนซอร์สภายใต้
ใบอนุญาต Apache 2.0
ดาวน์โหลดได้จาก GitHub ซึ่งคุณยังสามารถดูวิธีการติดตั้งและโค้ดตัวอย่างได้อีกด้วย
ขั้นตอนถัดไป
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-31 UTC
[null,null,["อัปเดตล่าสุด 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)."]]