# How can I get the height for given lat., lon.?

**URL:** <https://community.cesium.com/t/how-can-i-get-the-height-for-given-lat-lon/569>\
**Category:** CesiumJS\
**Created:** [June 22, 2013, 3:36pm UTC](https://community.cesium.com/t/how-can-i-get-the-height-for-given-lat-lon/569 "2013-06-22T15:36:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![researcher\_pim](https://avatars.discourse-cdn.com/v4/letter/r/91b2a8/32.png) [@researcher\_pim](https://community.cesium.com/u/researcher_pim)\
**Post date:** [June 22, 2013, 3:36pm UTC](https://community.cesium.com/t/how-can-i-get-the-height-for-given-lat-lon/569/1 "2013-06-22T15:36:37Z")

</div>

Hello,

Sorry, for this newbie question. Is there any direct way to get the height of given point on the ground with terrain? For example, point on a mountain, get the height.

Thanks,  
Shawn

---

<div class="post-metadata">

**Author:** ![Kevin\_Ring](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/kevin_ring/32/2003_2.png) [@Kevin\_Ring](https://community.cesium.com/u/Kevin_Ring)\
**Post date:** [June 23, 2013, 12:02pm UTC](https://community.cesium.com/t/how-can-i-get-the-height-for-given-lat-lon/569/2 "2013-06-23T12:02:58Z")

</div>

You can see the sampleTerrain function:

[http://cesium.agi.com/Cesium/Build/Documentation/sampleTerrain.html?classFilter=&show=all](http://cesium.agi.com/Cesium/Build/Documentation/sampleTerrain.html?classFilter=&show=all)

---

<div class="post-metadata">

**Author:** ![researcher\_pim](https://avatars.discourse-cdn.com/v4/letter/r/91b2a8/32.png) [@researcher\_pim](https://community.cesium.com/u/researcher_pim)\
**Post date:** [June 23, 2013, 2:55pm UTC](https://community.cesium.com/t/how-can-i-get-the-height-for-given-lat-lon/569/3 "2013-06-23T14:55:58Z")

</div>

I've read this link before. It require terrain data from provider sever for each height query. I am going in to fix issue #449, prevent camera get through ground. I discuss the method in this thread, [https://groups.google.com/forum/#!topic/cesium-dev/jQVFIOkk-K4.So](https://groups.google.com/forum/#!topic/cesium-dev/jQVFIOkk-K4.So) I want a way to get height real-time. The promise pattern cannot be used in "CameraController.prototype.move()/zoom()". My plan is to keep a less precise heightmap data structure in createMesh(). Then test the camera height with this heightmap data. It that way possible?

Shawn

---

<div class="post-metadata">

**Author:** ![Kevin\_Ring](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/kevin_ring/32/2003_2.png) [@Kevin\_Ring](https://community.cesium.com/u/Kevin_Ring)\
**Post date:** [June 24, 2013, 5:40pm UTC](https://community.cesium.com/t/how-can-i-get-the-height-for-given-lat-lon/569/4 "2013-06-24T17:40:44Z")

</div>

I should mention up front that if I had an easy and robust solution to this problem, I would have implemented it already. 🙂

That said, I can offer some suggestions…

In NORAD Tracks Santa, we implemented a solution based on rooting around in the CentralBodySurface’s list of rendered tiles, and checking the camera against the maxHeight of the tile containing the camera. This worked reasonably well. The downside is that the camera will not be allowed below the highest peak within the tile containing the camera. This is probably not a huge problem because the tile right under the camera tends to be pretty small. Keep in mind, though, that the the maxHeight can change as the terrain refines. For example, when only the level zero tile is loaded, the maxHeight of the tile under the camera is the height of Mount Everest.

Kevin

---

<div class="post-metadata">

**Author:** ![researcher\_pim](https://avatars.discourse-cdn.com/v4/letter/r/91b2a8/32.png) [@researcher\_pim](https://community.cesium.com/u/researcher_pim)\
**Post date:** [June 25, 2013, 1:58pm UTC](https://community.cesium.com/t/how-can-i-get-the-height-for-given-lat-lon/569/5 "2013-06-25T13:58:53Z")

</div>

I take another approach. Please check out this link, [https://groups.google.com/forum/#!topic/cesium-dev/jQVFIOkk-K4](https://groups.google.com/forum/#!topic/cesium-dev/jQVFIOkk-K4)
