How to stroke a line from some position on Earth to fixed point?

I want stroke a line from (long, lat)=(127, 37.5) to (screeX, screenY)=(0,0) like above image.

Create a polyline as shown here and set the arcType to NONE so it doesn’t curve with the surface of the Earth: https://sandcastle.cesium.com/index.html?src=Polyline.html

Thank you for your answer, but I don’t think it’s what I wanted. For example, I wanted to draw a line from the United States, to the search button on the screen.

It sounds like you’re trying to draw a line in 2D, outside of the 3D canvas. For that, you’d first get the location of the 3D point, (using the longitude, latitude, and height of the US) and then convert that to window coordinates:

https://cesium.com/docs/cesiumjs-ref-doc/SceneTransforms.html?classFilter=transform#.wgs84ToWindowCoordinates

And then you can create an HTML element on top of the canvas linking these two 2D positions, or go the other way around, converting the top left corner to a 3D position and drawing that line in 3D.

1 Like

Nice! Thank you for help.