# Solar system body positioning with CZML

**URL:** <https://community.cesium.com/t/solar-system-body-positioning-with-czml/34714>\
**Category:** CesiumJS\
**Created:** [August 21, 2024, 9:07pm UTC](https://community.cesium.com/t/solar-system-body-positioning-with-czml/34714 "2024-08-21T21:07:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zudo](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/zudo/32/24314_2.png) [@Zudo](https://community.cesium.com/u/Zudo)\
**Post date:** [August 21, 2024, 9:07pm UTC](https://community.cesium.com/t/solar-system-body-positioning-with-czml/34714/1 "2024-08-21T21:07:25Z")

</div>

Hello, I open this thread again because I found a solution working on interplanetary missions.

I am currently working on a library to interface [Orekit](https://www.orekit.org) and Cesium. Orekit is a high level java library that allows space mechanics computations, interplanetary computation are part of it.

In order to interface those two library, I decided to use the [CzmlWriter](https://github.com/AnalyticalGraphicsInc/czml-writer) and generate Czml files to be used in Cesium.

For the solar system, I then built 3D models of each planet (they are .glb files) :  
[Bodies.zip](https://community.cesium.com/uploads/short-url/uu0a8wiQCeo7ey6UDC5K1mDNfCM.zip) (12.5 MB)

Then in my Czml file, I build a new object, that admits a model (the 3D model of the planet), and the positions in time (computed with Orekit). In the Czml file, a planet could look like this :

```json
{
    "id":"BODY/Jupiter",
    "name":"Celestial body : Jupiter",
    "availability":"2004-01-01T00:00:00Z/2004-01-02T03:46:40Z",
    "position":{
      "interval":"2004-01-01T00:00:00Z/2004-01-02T03:46:40Z",
      "epoch":"2004-01-01T00:00:00Z",
      "cartesian":[
        0,250027473258.063,697066970420.4497,71418053738.74323,
        60,253074311226.22552,695964951405.7604,71417909208.94225,
        120,256116292260.37988,694849614949.3164,71417764678.49684,
        180,259153358151.68964,693720982455.7379,71417620147.43167,
        240,262185450785.64453,692579075584.0667,71417475615.77151,
        300,265212512143.18433,691423916247.3439,71417331083.54141,
        360,268234484301.78174,690255526612.2026,71417186550.76662,
        420,271251309436.56976,689073929098.433,71417042017.47235,
        480,274262929821.44238,687879146378.5553,71416897483.68414,
        540,277269287830.16046,686671201377.3845,71416752949.42784,
        600,280270325937.45374,685450117271.59,71416608414.7291
           ]
      }
     "model":{
      "gltf":"./jupiter.glb",
      "scale":1,
      "maximumScale":1E+100,
      "minimumPixelSize":400,
      "incrementallyLoadTextures":true,
      "show":true
    },
    "path":{
      "show":true,
      "interval":"2004-01-01T00:00:00Z/2004-01-02T03:46:40Z"
    },
    "orientation":{
      "interval":"2004-01-01T00:00:00Z/2004-01-02T03:47:00Z",
      "epoch":"2004-01-01T00:00:00Z",
      "unitQuaternion":[
        0,0.2195446283202605,-0.023039191509158036,-0.9700893871633347,-0.10097491145521675,
        60,0.2194937001017853,-0.023519419964578576,-0.9698661701958717,-0.10309686905890833,
        120,0.2194417214425548,-0.02399953586191643,-0.9696383116983073,-0.10521833326753133,
        180,0.21938869259132676,-0.024479536903459075,-0.9694058127611132,-0.10733929392830108,
        240,0.2193346138018828,-0.024959420792043545,-0.9691686744969702,-0.10945974089084257,
        300,0.2192794853330311,-0.025439185231069,-0.9689268980407605,-0.11157966400724656,
        360,0.21922330744860216,-0.0259188279245052,-0.9686804845495642,-0.11369905313210449,
        420,0.21916608041744945,-0.02639834657690441,-0.9684294352026529,-0.11581789812256385,
        480,0.21910780451344708,-0.026877738893413165,-0.968173751201484,-0.11793618883837866,
        540,0.2190484800154885,-0.02735700257978197,-0.9679134337696955,-0.12005391514195349,
        600,0.2189881072074863,-0.027836135342377367,-0.9676484841530996,-0.12217106689839455
      ]
      "interpolationAlgorithm":"LAGRANGE",
      "interpolationDegree":5
    }
  }
]

```

This way, I have the .glb file in a resources folder, loaded here locally. I used the ID : BODY/{name of the planet} and computed the rotation of the planet in order to fit the real with unit quaterions.

Here is the result :

 ![image](https://global.discourse-cdn.com/cesium/original/3X/0/f/0f270e0d4c4709d1c9236ea69e216eb53ba33a52.jpeg)

Hope it helps people who are still wondering how to do it, czml files are a great way to do so.

JL.

* * *

Note: This was originally posted as a response to [Mars and other planetary](https://community.cesium.com/t/mars-and-other-planetary/1330) , but moved to a new thread for better visibility

---

<div class="post-metadata">

**Author:** ![Zudo](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/zudo/32/24314_2.png) [@Zudo](https://community.cesium.com/u/Zudo)\
**Post date:** [August 23, 2024, 7:47am UTC](https://community.cesium.com/t/solar-system-body-positioning-with-czml/34714/5 "2024-08-23T07:47:05Z")

</div>

In order to guide people who would want to do the same as I do i created a [gitHub repository](https://github.com/Zudokakikuto/OreCzmlJSInterface) for the javascript interface.

It added the following features in the javascript interface :

- A button to switch the light off/on for the earth.
- A button to switch from the ICRF frame to the EME2000
- A button to display all the objects loaded from the CzmlFile (czml file made with [OreCzml](https://github.com/Zudokakikuto/OreCZML)).

With the last button you can choose in the ‘bodies’ tab the planets of the solar system if written in the CzmlFile.

In order to have a proper CzmlFile, I created a library that do the interface between Orekit and Cesium, named OreCzml available [here](https://github.com/Zudokakikuto/OreCZML). A wiki is currently begin created in order to guide users as they want to use it. A good knowledge of Orekit is advised in order to use OreCzml.

---

<div class="post-metadata">

**Author:** ![Marco13](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/marco13/32/2757_2.png) [@Marco13](https://community.cesium.com/u/Marco13)\
**Post date:** [August 23, 2024, 12:45pm UTC](https://community.cesium.com/t/solar-system-body-positioning-with-czml/34714/6 "2024-08-23T12:45:39Z")

</div>

That’s pretty cool. I could imagine that people could use this for interplanetary mission simulation, or missions between the Earth and the moon, using the recently published [Cesium Moon Terrain](https://cesium.com/blog/2024/08/06/introducing-cesium-moon-terrain) at the landing sites.

---

<div class="post-metadata">

**Author:** ![Zudo](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/zudo/32/24314_2.png) [@Zudo](https://community.cesium.com/u/Zudo)\
**Post date:** [August 23, 2024, 3:50pm UTC](https://community.cesium.com/t/solar-system-body-positioning-with-czml/34714/7 "2024-08-23T15:50:15Z")

</div>

This is very cool. One of the major problem of the loading of 3D files as I did with Czml files is that models only use flat imagery from the observations made. So the terrain aspect and the variations of altitude are not present.

I merely added the variation of the radius between the north and the equator or each planet.

What could be very interesting is to have a gradient zoom on each 3D model as it is done with the earth. But I don’t know if there is a feature of cesium allowing me to do so.
