# Convert long/lat/height to screen pixel x,y

**URL:** <https://community.cesium.com/t/convert-long-lat-height-to-screen-pixel-x-y/1149>\
**Category:** CesiumJS\
**Created:** [April 20, 2014, 3:48pm UTC](https://community.cesium.com/t/convert-long-lat-height-to-screen-pixel-x-y/1149 "2014-04-20T15:48:25Z")\
**Posts on this page:** 4\
**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:** [April 20, 2014, 3:48pm UTC](https://community.cesium.com/t/convert-long-lat-height-to-screen-pixel-x-y/1149/1 "2014-04-20T15:48:25Z")

</div>

Hi, All,  
Is there any helper class, which can convert a point from long/lat/height screen pixel x,y ?

Thanks,  
-Jonathan

---

<div class="post-metadata">

**Author:** ![Matt\_Amato](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/matt_amato/32/1993_2.png) [@Matt\_Amato](https://community.cesium.com/u/Matt_Amato)\
**Post date:** [April 21, 2014, 1:48am UTC](https://community.cesium.com/t/convert-long-lat-height-to-screen-pixel-x-y/1149/2 "2014-04-21T01:48:17Z")

</div>

[SceneTransforms.wgs84ToWindowCoordinates](http://cesiumjs.org/Cesium/Build/Documentation/SceneTransforms.html?classFilter=SceneTransforms&show=js#wgs84ToWindowCoordinates) is what you want. You’ll need to convert the long/lat/height to a Cartesian3 first, which you can do with [Ellipsoid.WGS84.cartesianToCartographic](http://cesiumjs.org/Cesium/Build/Documentation/Ellipsoid.html?classFilter=Ellipsoid&show=all#cartographicToCartesian)

---

<div class="post-metadata">

**Author:** ![Bulent\_Ozhorasan](https://avatars.discourse-cdn.com/v4/letter/b/9dc877/32.png) [@Bulent\_Ozhorasan](https://community.cesium.com/u/Bulent_Ozhorasan)\
**Post date:** [June 27, 2014, 3:05pm UTC](https://community.cesium.com/t/convert-long-lat-height-to-screen-pixel-x-y/1149/3 "2014-06-27T15:05:23Z")

</div>

Hi Matthew,  
Many thanks to the Cesium Team for such a great product.

I need to translate from window coordinates (x,y) to Cartesian3 coordinates?

I checked the documentation and SceneTransforms doesn’t have such a method?

Looking forward to getting Version 1.0 of Cesium in August! 🙂

---

<div class="post-metadata">

**Author:** ![Matt\_Amato](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/matt_amato/32/1993_2.png) [@Matt\_Amato](https://community.cesium.com/u/Matt_Amato)\
**Post date:** [June 27, 2014, 6:00pm UTC](https://community.cesium.com/t/convert-long-lat-height-to-screen-pixel-x-y/1149/4 "2014-06-27T18:00:55Z")

</div>

scene.camera.pickEllipsoid is what you want to use. That function will return the cartesian position on the earth at the provided x/y or undefined if the xy is not over the globe. This Sandcastle example shows it in action (position under mouse cursor):

[http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Picking.html&label=Showcases](http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Picking.html&label=Showcases)

The reason it requires the position to be over the globe is simple, when going from Cartesian -\> ScreenSpace there is exactly one pixel that the cartesian position maps into (multiple cartesians can map into the same pixel, but that’s okay because we still get the result we want). When going from ScreenSpace-\>Cartesian, you have an infinite number of positions that each pixel can map into (because of depth). By using the rendered globe as a reference, you are saying the depth you want is the current depth of the globe at that pixel.

Hope that helps,

Matt
