Why location inconsistent when moving around map

Hello,

Do you guys know why locations are inconsistent when we zoom-in-out or move around the map?

Locations on this map are added by:

cesiumViewer.current?.entities.add({
          position: new CesiumJs.Cartesian3(p[0],p[1],p[2]),

Also, I can zoom in quite a bit but, after some level, the dot disappears, if i zoom out it comes back, so it seems like there is a limit to zooming in after which point each dot disappears. Is it possible to make these positions dont ever disappear no matter how much you zoom in?

or is it consistent its just angle of which i am looking is different if item is not in the center?

The issue arises because you’re adding locations directly using Cartesian3 coordinates (CesiumJs.Cartesian3(p[0],p[1],p[2])) without properly converting them to Cesium’s Ellipsoid model. This can cause inconsistencies, especially when zooming or changing the camera angle.

const cartographicPos = Cesium.Cartographic.fromDegrees(p[0],p[1],p[2]);
const adjustedPos =map.scene.globe.ellipsoid.cartographicToCartesian(cartographicPos);

I hope this helps

1 Like

Hi @Egemen_Ozgur,

Tesekkurler / Thank you.

It didn’t work, points are flying randomly on the map and are not correct. I applied below

        const cartographicPos = CesiumJs.Cartographic.fromDegrees(
          p[0],
          p[1],
          p[2]
        );
        const cartesian =
          cesiumViewer.current?.scene.globe.ellipsoid.cartographicToCartesian(
            cartographicPos
          );
        if (cartesian) {
          cartesianPositions.push(cartesian);
          cesiumViewer.current?.entities.add({
            position: cartesian,
          });
        }

also, this behavior may be correct in terms of map view and my thinking may be wrong. For example if I load the map and I have a position above a very specific location on the map, then when I move, at an angle I look, position doesnt look like they are above that location but they are it’s just my angle is off, maybe this is what’s happening.