Sun position and elevation

Hello everybody! :slight_smile:

For my Cesium App (paragliding simulator online) I am searching a way to know the precise sun position in the sky, in terms of orientation and elevation on the horizon, knowing a position on the earth and an UTC time.

I know that there are very complicated formulas to do that… but since Cesium Engine have the capability to draw the sun in the sky… i thought that it had just done the “dirty job” :D… there is a way to retrieve those informations?

Thank you!

some time ago somebody suggested to me to use this functions :
"to get the sun position use Simon1994PlanetaryPositions.computeSunPositionInEarthInertialFrame and Transforms.computeTemeToPseudoFixedMatrix"

but i can’t understand how exactly… can somebody provide me an example?

serching in the source code i found also this : “viewer.scene.context.uniformState.sunPositionWC”… but similar to the other function (Simon1994PlanetaryPositions.computeSunPositionInEarthInertialFrame) this returns 3 numbers than i am not able to understand…

how to get the sun position elevation in degrees?

Hello,

Cesium does indeed compute and draw the sun where it should be depending on the time. It looks like you found the function we use to do Simon1994PlanetaryPositions.computeSunPositionInEarthInertialFrame. That function takes a JulianDate as the input and returns a Cartesian3 for the sun’s position.

You will have to do your own calculations to figure out the orientation and elevation from a position on the earth surface.

Best,

Hannah