Get started - Zudokakikuto/OreCZML GitHub Wiki
How to generate a CZML file ?
Prerequisities
-
Java 8 or more
-
Orekit >= V 1.12
-
junit-jupiter >= V 5.10.2
-
czml-writer >= V 3.0.0
-
A directory and a path of the inputs if there are some.
-
A directory and a path of the output.
CZML Structure
In order to understand how a CZML file is organized, please check the tutorial.
Usage
How to build your CZML file
- With an OEM file
You will need first to build an OEMFile object with a given path
OEMFile oemFile = new OEMFile(inputPath);
You will then be able to build the header of your CZML file and to write it
Header headerOEM = oemFile.getHeader();
headerOEM.write();
If you want to see a satellite you can then build a Sattelite Object, write it and end the file
Satellite satelliteCZML = new Satellite(oemFile,header);
satelliteCZML.write();
satelliteCZML.endFile();
Finally you create your output file with a path and the path with the name of your file
CZMLFile CZMLfile = new CZMLFile(pathName,outputPath);
CZMLFile.write(headerOEM);
CZMLFile.write(satelliteCZML);
- With a list of Orekit SpacecraftStates
It is the same method : Creation of a header, write it, creation of a satellite, write it. You will just need to create a SpacecraftStateListInput object
// Object
SpacecraftStateListInput input = new SpacecraftStateListInput(spacecraftStateList);
// Header
Header header = input.getHeader();
header.write();
// Satellite
Satellite satelliteSpacecraftStates = new Satellite(input,header);
satelliteSpacecraftStates.write();
satelliteSpacecraftStates.endFile();
// Output File
CZMLFile CZMLfile = new CZMLFile(pathName,outputPath);
CZMLFile.write(header);
CZMLFile.write(satelliteSpacecraftStates);
- With an Orekit Orbit
You will need to first create an Orekit Orbit, then to create an OrbitInput object. You will then need to enter the Type of Orbit with the Orekit OrbitType (here KEPLERIAN is used), and the timescale supported is UTC.
// Object
OrbitInput orbitInput = new OrbitInput(orbit, OrbitType.KEPLERIAN,UTC);
// Header
Header header = orbitInput.getHeader();
header.write();
// Satellite
Satellite satelliteOrbit = new Satellite(orbitInput,header);
satelliteOrbit.write();
satelliteOrbit.endFile();
// Output File
CZMLFile CZMLfile = new CZMLFile(pathName,outputPath);
CZMLFile.write(header);
CZMLFile.write(satelliteOrbit);
Use with Cesium Sandbox
The cesium sandbox is a web interface that allows the user to display online CesiumJS code for visualisation. CesiumJS is a javascript library that can displays 3D scenes around central bodies. CesiumJS understands CZML file and can load them into the scene.
Here is a basic load of a CZML file in cesiumJS :
const czml = "ENTER YOUR CZML HERE" ;
const viewer = new Viewer("cesiumContainer");
const czmlDataSource = Cesium.CzmlDataSource.load(czml);
viewer.dataSources.add(czmlDataSource);
viewer.scene.globe.enableLighting = true;
Use Cesium locally
The cesium sandcastle is good to display small czml files, but when file are quite bigger, it is advised to load cesium locally in order to compute bigger simulations. To do so a repository has been created to work with OreCZML. You will find there all instructions to launch cesium locally.