# Cesium.SceneTransforms.wgs84ToWindowCoordinates(scene, position)   result undefined

**URL:** <https://community.cesium.com/t/cesium-scenetransforms-wgs84towindowcoordinates-scene-position-result-undefined/4333>\
**Category:** CesiumJS\
**Created:** [July 7, 2016, 1:40pm UTC](https://community.cesium.com/t/cesium-scenetransforms-wgs84towindowcoordinates-scene-position-result-undefined/4333 "2016-07-07T13:40:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Galeups](https://avatars.discourse-cdn.com/v4/letter/g/f04885/32.png) [@Galeups](https://community.cesium.com/u/Galeups)\
**Post date:** [July 7, 2016, 1:40pm UTC](https://community.cesium.com/t/cesium-scenetransforms-wgs84towindowcoordinates-scene-position-result-undefined/4333/1 "2016-07-07T13:40:02Z")

</div>

Hello!  
Use Cesium.SceneTransforms.wgs84ToWindowCoordinates(scene, position) with position camera result undefined.

I change the camera angle middle mouse button, result Ok.

I need to get the coordinates of the mouse click, to accommodate infobox.

Sandcastl:

var viewer = new Cesium.Viewer(‘cesiumContainer’);

viewer.camera.lookAt(Cesium.Cartesian3.fromDegrees(20.5, 54.7),

new Cesium.Cartesian3(35000.0, -200000.0, 100000.0));

viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);

var scene = viewer.scene;

var ellipsoid = scene.globe.ellipsoid;

var position = Cesium.Cartesian3.fromDegrees(0.0, 0.0);

var handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);

handler.setInputAction(function(movement) {

console.log(Cesium.SceneTransforms.wgs84ToWindowCoordinates(scene, position));

}, Cesium.ScreenSpaceEventType.LEFT\_CLICK);

What am I doing wrong?

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:** [July 7, 2016, 2:53pm UTC](https://community.cesium.com/t/cesium-scenetransforms-wgs84towindowcoordinates-scene-position-result-undefined/4333/2 "2016-07-07T14:53:34Z")

</div>

Hello,

You’re not doing anything wrong. If you read the documentation for wgs84ToWindowCoordinates it says that it may return undefined. Every once in a while, the math to compute the window position doesn’t quite work out.

I know this is supposed to be the case for a position close to the center of the earth, but it should be able to find the position in the example you gave. I created this issue so that we can look into why it isn’t working: [https://github.com/AnalyticalGraphicsInc/cesium/issues/4098](https://github.com/AnalyticalGraphicsInc/cesium/issues/4098)

Best,

Hannah

---

<div class="post-metadata">

**Author:** ![Bryce\_Christensen](https://avatars.discourse-cdn.com/v4/letter/b/b487fb/32.png) [@Bryce\_Christensen](https://community.cesium.com/u/Bryce_Christensen)\
**Post date:** [July 8, 2016, 1:29am UTC](https://community.cesium.com/t/cesium-scenetransforms-wgs84towindowcoordinates-scene-position-result-undefined/4333/3 "2016-07-08T01:29:35Z")

</div>

Additonally, **SceneTransforms.wgs84WithEyeOffsetToWindowCoordinates** can return undefined here:

`if (positionCC.z < 0 && frameState.mode !== SceneMode.SCENE2D) { return undefined; }`

Which is not handled in **Billboard.\_computeScreenSpacePosition** , there is not undefined or null check, throwing an error when retriveing the x/y properties here:

`positionWC.x += po.x; positionWC.y += po.y;`

Cheers

Bryce
