Exploring Chandrayaan 3 Satellite Data: Tracking Altitude with JavaScript


Space exploration has always captivated human imagination, and advancements in technology have made it possible to track satellites orbiting our planet. Chandrayaan 3, India's lunar mission, is an exciting endeavor that has garnered global attention. In this blog, we'll explore a simple JavaScript code that fetches the latest data for Chandrayaan 3 satellite and prints out its current altitude. We'll break down the code step-by-step to understand how it works.


Before diving into the code, it's helpful to have a basic understanding of JavaScript, Node.js, and some knowledge about satellite tracking and orbital mechanics.

The Code Explained

Let's take a closer look at the JavaScript code provided:

const satellite = require('satellite.js');
const lodash = require('lodash');
const superagent = require('superagent');

let iter = 0;

const interval = setInterval(async () => {
    const response = await superagent.get("https://celestrak.org/NORAD/elements/gp.php?CATNR=57320&FORMAT=tle")
    const CHANDRAYAAN_3_TLE = response.text;
    const satrec = satellite.twoline2satrec(

    const positionAndVelocity = satellite.propagate(satrec, new Date());
    const gmst = satellite.gstime(new Date());
    const p   = satellite.eciToGeodetic(positionAndVelocity.position, gmst);
    iter += 1;
    console.log("Chandrayaan 3 Altitude (km)", lodash.round(p.height, 2));
    if (iter > 10) {
      iter = 0;
  }, 1000);

process.on('SIGINT', function() {
  console.log("\nHappy Moon Landing!");

Step 1: Importing Required Modules

At the beginning of the code, we import three Node.js modules: satellite.js, lodash, and superagent. These modules enable us to perform satellite tracking calculations, round numbers to a specific decimal point, and make HTTP requests, respectively.

Step 2: Initializing Variables

The code sets up a variable called iter to keep track of the number of iterations. This will be used to clear the console after every ten iterations to avoid clutter.

Step 3: Fetching Satellite Data

The code uses superagent to make an HTTP GET request to "celestrak.org/NORAD/elements/gp.php?CATNR=5..". This URL provides the Two-Line Elements (TLE) data for Chandrayaan 3 satellite. TLE data is a standard format used to describe the orbits of satellites.

Step 4: Processing Satellite Data

Once the TLE data is fetched, it is split into individual lines and passed to satellite.twoline2satrec() from the satellite.js module. This function converts the TLE data into a satellite record (satrec) that can be used for further calculations.

Step 5: Calculating Altitude

Using the satellite record (satrec), the code calls satellite.propagate() with the current date to calculate the satellite's position and velocity. It then computes the Greenwich Mean Sidereal Time (gmst) and subsequently uses satellite.eciToGeodetic() to convert the satellite's position from Earth-Centered Inertial (ECI) coordinates to geodetic coordinates, which includes the altitude information.

Step 6: Displaying Altitude

The code then prints out the current altitude of Chandrayaan 3 in kilometers, rounded to two decimal places, using console.log() and the lodash.round() function.

Step 7: Iteration and Console Clearing

To avoid excessive console output, the code increments the iter variable and clears the console after every ten iterations. This ensures that we only see the latest altitude.

Step 8: Graceful Exit

The code sets up a signal event listener to handle SIGINT, which is the signal sent when the user presses Ctrl+C to stop the program. Upon receiving the signal, the code displays a parting message, clears the interval, and gracefully exits the process.


In this blog, we've explored a simple yet fascinating JavaScript code that fetches the latest data for Chandrayaan 3 satellite and tracks its current altitude using satellite tracking and orbital mechanics calculations. By understanding this code, you've taken a peek into the world of satellite tracking and its applications in space exploration. You can further enhance this code to include additional information or build interactive web applications to visualize satellite orbits and positions in real-time. The possibilities are vast, and the cosmos is waiting to be explored! Happy coding and moon landing!