# Question about the altitude value around east coast when migrated from Google

**URL:** <https://community.cesium.com/t/question-about-the-altitude-value-around-east-coast-when-migrated-from-google/3312>\
**Category:** CesiumJS\
**Created:** [November 12, 2015, 10:49pm UTC](https://community.cesium.com/t/question-about-the-altitude-value-around-east-coast-when-migrated-from-google/3312 "2015-11-12T22:49:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![wilson1256](https://avatars.discourse-cdn.com/v4/letter/w/dfb087/32.png) [@wilson1256](https://community.cesium.com/u/wilson1256)\
**Post date:** [November 12, 2015, 10:49pm UTC](https://community.cesium.com/t/question-about-the-altitude-value-around-east-coast-when-migrated-from-google/3312/1 "2015-11-12T22:49:47Z")

</div>

By compare with Google Earth, the altitude, when using Cesium, I got around east coast are always negative values.  
I found the demo on the website [http://analyticalgraphicsinc.github.io/cesium-google-earth-examples/examples/groundAlt.html](http://analyticalgraphicsinc.github.io/cesium-google-earth-examples/examples/groundAlt.html)  
On this page, the value is exactly from what I have with my code, but still they are negative ones. I am not sure if this is the problems with the altitude resource or Cesium is actually using different standard when computing the altitude. If, the answer is the latter, can I convert the negative values? Thanks.

---

<div class="post-metadata">

**Author:** ![hannah](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/hannah/32/4509_2.png) [@hannah](https://community.cesium.com/u/hannah)\
**Post date:** [November 13, 2015, 6:30pm UTC](https://community.cesium.com/t/question-about-the-altitude-value-around-east-coast-when-migrated-from-google/3312/2 "2015-11-13T18:30:00Z")

</div>

Hello,

The accuracy of the results returned by viewer.scene.globe.pick depends on the level of the terrain tile that is loaded. When you’re zoomed out further away from the globe, the accuracy is less accurate than when you’re zoomed in really close to the terrain.

For consistent results, you can use the [sampleTerrain](http://cesiumjs.org/Cesium/Build/Documentation/sampleTerrain.html) function. Here’s an example that always queries the 12th level of terrain to get the height:

var handler = new Cesium.ScreenSpaceEventHandler(viewer.canvas, false);  
handler.setInputAction(  
function(click) {  
var ray = viewer.camera.getPickRay(click.position);  
var position = viewer.scene.globe.pick(ray, viewer.scene);  
if (Cesium.defined(position)) {  
var positionCartographic = Cesium.Ellipsoid.WGS84.cartesianToCartographic(position);

```
        Cesium.when(Cesium.sampleTerrain(viewer.terrainProvider, 12, [positionCartographic]),
        function(adjustedPositions){
            var span = document.getElementById('alt');
            span.textContent = adjustedPositions[0].height.toFixed(2);

        });
    }
},
Cesium.ScreenSpaceEventType.LEFT_CLICK

```

);

``

Best,

Hannah

---

<div class="post-metadata">

**Author:** ![Matt\_Whalley](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/matt_whalley/32/2115_2.png) [@Matt\_Whalley](https://community.cesium.com/u/Matt_Whalley)\
**Post date:** [November 13, 2015, 7:08pm UTC](https://community.cesium.com/t/question-about-the-altitude-value-around-east-coast-when-migrated-from-google/3312/3 "2015-11-13T19:08:18Z")

</div>

Note that ge.ALTITUDE\_ABSOLUTE in GE is MSL and the altitude in Cesium is WGS84 (the difference is called undulation). When transitioning code from GE to Cesium one needs to account for this difference. There are online calculators that will give you the Geoid height/undulation for a particular lat/lng.

- Matt
