Example of Cesium JS application to display the movement of the iss satellite

Here is the JavaScript code:

<!DOCTYPE html>
<html lang="en">
<head>
  ; <script src="https://cesium.com/downloads/cesiumjs/releases/1.81/Build/Cesium/Cesium.js"></script>
  <link href="https://cesium.com/downloads/cesiumjs/releases/1.81/Build/Cesium/Widgets/widgets.css" rel="stylesheet">
  <script src="https://cdnjs.cloudflare.com/ajax/libs/satellite.js/4.0.0/satellite.js"></script>
  <link href="style.css" rel="stylesheet">
</head> ;
<body>
  <div id="loading">
    <h1>Loading...</h1>
  </div>
  <div id="cesiumContainer"></div>
  <script>
    // Initialize the Cesium viewer.
    const viewer = new Cesium.Viewer('cesiumContainer', {
      imageryProvider: new Cesium.TileMapServiceImageryProvider({
        url: Cesium.buildModuleUrl(" Assets/Textures/NaturalEarthII"),
      }),
      baseLayerPicker: false, geocoder: false, homeButton: false, infoBox: false,
      navigationHelpButton: false, sceneModePicker: false
    });
    // This causes a bug on android, see: https://github.com/CesiumGS/cesium/issues/7871
    // viewer. scene. globe. enableLighting = true;
    // These 2 lines are published by NORAD and allow us to predict where
    // the ISS is at any given moment. They are updated regularly.
    // Get the latest from: https://celestrak.com/satcat/tle.php?CATNR=25544. 
    const ISS_TLE = 
    `1 25544U 98067A   21121.52590485  .00001448  00000-0  34473-4 0  9997
    2 25544  51.6435 213.5204 0002719 305.2287 173.7124 15.48967392281368`;
    const satrec = satellite. twoline2satrec(
      ISS_TLE.split('\n' )[0].trim(), 
      ISS_TLE.split( '\n')[1].trim()
    );
    // Give SatelliteJS the TLE's and a specific time.
    // Get back a long it More about this source textSource text required for additional translation information Send feedback Side panels History Saved Contribute 5,000 character limit. Use the arrows to translate more.

No comments:

Post a Comment