Getting label screen space position

In cesium documentation i saw the function to get the label positions.

But when i try this function its telling this

Uncaught TypeError: label.computeScreenSpacePosition is not a function


Can you please provide a little bit more information on how you are accessing this member? Moving forward I would love to see a sandcastle demo that showcases how you are getting this error.


Please check the sandcastle example


I just looked over your sandcastle demo. The primary issue is that label.label is a LabelGraphics object and not a Label object. Thus, it does not have the member function computeScreenSpacePosition. In order to use the member function computeScreenSpacePosition, you must use a Label object. Is there any reason why you are using a LabelGraphics object and not a Label object? Please check out these resources.

Let me know if you have any other questions or concerns! I am looking forward to learning more about your project.


Thanks for the clarification, I have to render a lot of labels on scene. With these labels there are overlaps happening. so i need to detect intersection of labels and add a combined label. This is my use case

Viewer.entites.add may internally be creating a label object. But how should i access the object. Can you please provide a sandcastle example?