# pickEllipsoid in 2d with a trackedEntity set producing incorrect coordinates.

Hello, I have a working solution to calculate the bounds of the viewport using the pickEllipsoid() function provided by the Cesium.Viewer.camera. It works for 2D and 3D. The picking part looks like this:

getLatLonFromPixel = function(viewer, x, y) {
var pixel = new Cesium.Cartesian2(x, y);
var ellipsoid = viewer.scene.globe.ellipsoid;
var cartesian = viewer.camera.pickEllipsoid(pixel, ellipsoid);
if (cartesian) {
var cartographic = ellipsoid.cartesianToCartographic(cartesian);
return {
latitude: Cesium.Math.toDegrees(cartographic.latitude),
longitude: Cesium.Math.toDegrees(cartographic.longitude)
};
}
return null;
};

``

I recently added in entity tracking using the Viewer.trackedEntity, while the tracked entity is set the bounds are correctly calculated in 3D, but not in 2D.

I have included some calculated bounds from adding a console line.

3D with no entity being tracked:

north: 42.79154866747982, south: 40.97543616484347, east: -68.4164021205193, west: -72.88803850857998

3D with an entity being tracked:

north: 42.363594155001614, east: -70.01866640806165, south: 41.405727044270265, west: -71.78853254159573

2D with no entity being tracked:

north: 42.382604597019046, east: -70.67532426625976, south: 41.42473748628768, west: -72.44519039979383

2D with an entity being tracked:

north: 0.00024308806452135405, east: 0.00044915764205976055, south: -0.00024308806452135392, west: -0.0004491576420597605

The values I am getting for the 2d with an entity being tracked makes no sense. I have tried using the globe.pick(ray, scene), but that did not seem to work with the 2D map.

Any one have any idea what I might be missing?

Thanks!

Hello,

We created an issue to fix this bug a few days ago: https://github.com/AnalyticalGraphicsInc/cesium/issues/3242

Keep an eye on that issue for any updates.

Best,

Hannah