# Query elevation or Sample for Height on Locally hosted terrain

**URL:** <https://community.cesium.com/t/query-elevation-or-sample-for-height-on-locally-hosted-terrain/35919>\
**Category:** CesiumJS\
**Created:** [October 20, 2024, 11:46pm UTC](https://community.cesium.com/t/query-elevation-or-sample-for-height-on-locally-hosted-terrain/35919 "2024-10-20T23:46:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![brent252](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/brent252/32/3476_2.png) [@brent252](https://community.cesium.com/u/brent252)\
**Post date:** [October 20, 2024, 11:46pm UTC](https://community.cesium.com/t/query-elevation-or-sample-for-height-on-locally-hosted-terrain/35919/1 "2024-10-20T23:46:15Z")

</div>

Trying to get the value from my locally hosted terrain: Is this possible? I’m running into problems. Just wanted to make a function to return the height value when called.

const localTerrainProvider = await Cesium.CesiumTerrainProvider.fromUrl(  
‘[http://localhost/](http://localhost/)’, {  
requestVertexNormals: true,  
requestWaterMask: true  
});

---

<div class="post-metadata">

**Author:** ![jjspace](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/jjspace/32/4102_2.png) [@jjspace](https://community.cesium.com/u/jjspace)\
**Post date:** [October 22, 2024, 1:56pm UTC](https://community.cesium.com/t/query-elevation-or-sample-for-height-on-locally-hosted-terrain/35919/2 "2024-10-22T13:56:30Z")

</div>

Hi @brent252, thanks for the question.

I would expect [`sampleTerrain`](https://cesium.com/learn/cesiumjs/ref-doc/global.html?classFilter=Sam#sampleTerrain) or [`sampleTerrainMostDetailed`](https://cesium.com/learn/cesiumjs/ref-doc/global.html?classFilter=Sam#sampleTerrainMostDetailed) to work even on locally hosted data.  
Please try those if you haven’t then if you’re still having issues please provide more information on the errors you’re seeing.
