GithubHelp home page GithubHelp logo

davidcalhoun / tle.js Goto Github PK

View Code? Open in Web Editor NEW
139.0 5.0 28.0 2.83 MB

🛰️ Satellite TLE tools in JavaScript: get lat/lon of satellites, get look angles, plot orbit lines, extract individual TLE elements, etc

License: MIT License

JavaScript 100.00%
tle sgp4 space satellites gps spacecraft orbital-mechanics javascript

tle.js's Introduction

tle.js

npm downloads

Satellite TLE tools in JavaScript

Installation

npm add tle.js or yarn add tle.js

Introduction

tle.js is designed to simplify satellite TLEs and SGP4 with a friendly interface, with satellite.js doing the heavy lifting behind the scenes.

The origin of TLEs goes back to the punchcard days! A TLE, or two-line element set, is used by SGP4 propagators to determine spacecraft positioning information, taking into account gravity perturbations (the moon, etc).

Most users will probably want to simply get the latitude/longitude of a satellite (see getLatLngObj) or get the look angles from a ground position, which can be used to track where in the sky a satellite is visible (see getSatelliteInfo). Users may also want to plot orbit lines (see getGroundTracks).

Users may also be interested in grabbing specific values from a TLE. In this case, you can use one of the TLE getters, for instance getCOSPAR.

Note that TLEs should be updated at least daily to avoid drift in calculations. You can get them online at Celestrak, where they are updated every few hours.

More info on TLEs:

Support for CommonJS (e.g. Node <=12)

If you are using an older version of Node or a package that doesn't yet have ES Module support (and are getting the error ERR_REQUIRE_ESM), you will need to point to the special CommonJS build target. Simply change the import format in the following examples to this require format:

-import { getLatLngObj } from "tle.js";
+const { getLatLngObj } = require("tle.js/dist/tlejs.cjs");

Support for Node 9 and older

Please install tle.js version '3.x.x':

npm i tle.js@3

Shared code

Let's start out with some code to define some variables which we'll use in many examples below.

// Satellite TLE; should be updated at least once a day for best results.
// TLE source: http://celestrak.com/NORAD/elements/
const tle = `ISS (ZARYA)
1 25544U 98067A   17206.18396726  .00001961  00000-0  36771-4 0  9993
2 25544  51.6400 208.9163 0006317  69.9862  25.2906 15.54225995 67660`;

Two-line variants and an array of strings are also accepted.

getLatLngObj(tle, optionalTimestampMS)

Computes the latitude/longitude of a spacecraft. Defaults to the current local time if optionalTimestampMS is not passed in.

Note: the greater the difference between this timestamp and the TLE epoch (when the TLE was generated) will result in inaccuracies or even errors.

import { getLatLngObj } from "tle.js";
const optionalTimestampMS = 1502342329860;
const latLonObj = getLatLngObj(tle, optionalTimestampMS);
->
{
  lat: -47.64247588153391,
  lng: -29.992233800623634
}

getGroundTracks(options)

Async function that returns a Promise that resolves with an array of longitude, latitude pairs for drawing the ground track (satellite path) for three orbits: one past orbit, one current orbit, and one future orbit.

Orbits start and stop at the international date line (antemeridian) because values passing over that line is commonly problematic in mapping.

Note: the synchronous version of this function, getGroundTracksSync, has the same function signature (it accepts the same inputs).

import { getGroundTracks } from 'tle.js';

const threeOrbitsArr = await getGroundTracks({
    tle: tleStr,

    // Relative time to draw orbits from.  This will be used as the "middle"/current orbit.
    startTimeMS: 1502342329860,

    // Resolution of plotted points.  Defaults to 1000 (plotting a point once for every second).
    stepMS: 1000,

    // Returns points in [lng, lat] order when true, and [lat, lng] order when false.
    isLngLatFormat: true,
});

// Alternatively, if your setup doesn't support async/await:
getGroundTracks({
    tle: tleStr,
    startTimeMS: 1502342329860,
    stepMS: 1000,
    isLngLatFormat: true,
}).then(function (threeOrbitsArr) {
    // Do stuff with three orbits array here.
});

// threeOrbitsArr contents
[
    // previous orbit
    [
        [-179.93297540317567, 45.85524291891481],
        // etc...
    ],

    // current orbit
    [
        [-179.9398612198045, 51.26165992503701],
        // etc...
    ],

    // next orbit
    [
        [-179.9190165549038, 51.0273714070371],
        // etc...
    ],
];

getSatelliteInfo(tle, optionalTimestamp, observerLat, observerLng, observerElevation)

Get both look angles (for a ground observer) as well as a few more tidbits of satellite info.

import { getSatelliteInfo } from "tle.js";
const satInfo = getSatelliteInfo(
  tleStr,         // Satellite TLE string or array.
  1501039265000,  // Timestamp (ms)
  34.243889,      // Observer latitude (degrees)
  -116.911389,    // Observer longitude (degrees)
  0               // Observer elevation (km)
);

->
{
  // satellite compass heading from observer in degrees (0 = north, 180 = south)
  azimuth: 294.5780478624994,

  // satellite elevation from observer in degrees (90 is directly overhead)
  elevation: 81.63903620330046,

  // km distance from observer to spacecraft
  range: 406.60211015810074,

  // spacecraft altitude in km
  height: 402.9082788620108,

  // spacecraft latitude in degrees
  lat: 34.45112876592785,

  // spacecraft longitude in degrees
  lng: -117.46176597710809,

  // spacecraft velocity (relative to observer) in km/s
  velocity: 7.675627442183371
}

getVisibleSatellites(options)

Calculates satellites visible relative to an observer's position.

import { getVisibleSatellites } from "tle.js";
const allVisible = getVisibleSatellites({
  observerLat: 34.439283990227125,
  observerLng: -117.47561122364522,
  observerHeight: 0,

  // Array of 3-line TLE arrays.
  tles: uniqTLES,

  // Filters satellites above a certain elevation (0 is horizon, 90 is directly overhead).
  // E.g. 75 will only return satellites 75 degrees or greater above the horizon.
  // Defaults to 0.
  elevationThreshold: 75,

  // Defaults to current time.
  timestampMS: 1570911182419
});
->
[
  {
    tleArr: [
      'COSMOS 2492 [GLONASS-M]',
      '1 39620U 14012A   19285.51719791 -.00000065  00000-0  10000-3 0  9999',
      '2 39620  65.6759  35.9755 0011670 324.9338 289.9534  2.13103291 43246'
    ],
    info: {
      lng: -124.83404516738146,
      lat: 32.070522714505586,
      elevation: 81.2241916805502,
      azimuth: 251.01601040118692,
      range: 19217.756476304672,
      height: 19161.979896618526,
      velocity: 3.9490073154305385
    }
  },
  {
    tleArr: [
      'GSAT0203 (GALILEO 7)',
      '1 40544U 15017A   19284.43409211 -.00000061  00000-0  00000+0 0  9996',
      '2 40544  56.2559  48.3427 0003736 223.0231 136.9337  1.70475323 28252'
    ],
    info: {
      lng: -117.86836105927033,
      lat: 29.08239877156373,
      elevation: 83.16839172166615,
      azimuth: 183.67559090645165,
      range: 23256.47316878015,
      height: 23221.387218003325,
      velocity: 3.6703580049175333
    }
  }
]

Basic TLE getters

In addition to the powerful functions above, there are also helpful functions for getting specific information from a TLE itself.

For further reading, see Kelso's article.

Shared TLE for below examples.

const tle = `ISS (ZARYA)
1 25544U 98067A   17206.18396726  .00001961  00000-0  36771-4 0  9993
2 25544  51.6400 208.9163 0006317  69.9862  25.2906 15.54225995 67660`;

getSatelliteName(tle)

Returns the name of the satellite. Note that this defaults to 'Unknown' for 2-line TLEs that lack the satellite name on the first line.

import { getSatelliteName } from "tle.js";
getSatelliteName(tle);
-> 'ISS (ZARYA)'

getCatalogNumber(tle)

Returns the NORAD satellite catalog number. Used since Sputnik was launched in 1957 (Sputnik's rocket was 00001, while Sputnik itself was 00002).

  • Range: 0 to 99999
import { getCatalogNumber } from "tle.js";
getCatalogNumber(tle);
-> 25544

getCOSPAR(tle)

Returns the COSPAR id string, aka international designator.

import { getCOSPAR } from "tle.js";
getCOSPAR(tle);
-> "1998-067A"

getClassification(tle)

Returns the satellite classification.

  • 'U' = unclassified
  • 'C' = classified
  • 'S' = secret
import { getClassification } from "tle.js";
getClassification(tle);
-> 'U'

getIntDesignatorYear(tle)

Launch year (last two digits) (international designator), which makes up part of the COSPAR id.

Note that a value between 57 and 99 means the launch year was in the 1900s, while a value between 00 and 56 means the launch year was in the 2000s.

  • Range: 00 to 99
import { getIntDesignatorYear } from "tle.js";
getIntDesignatorYear(tle);
-> 98

getIntDesignatorLaunchNumber(tle)

Launch number of the year (international designator), which makes up part of the COSPAR id.

  • Range: 1 to 999
import { getIntDesignatorLaunchNumber } from "tle.js";
getIntDesignatorLaunchNumber(tle);
-> 67

getIntDesignatorPieceOfLaunch(tle)

Piece of the launch (international designator), which makes up part of the COSPAR id.

  • Range: A to ZZZ
import { getIntDesignatorPieceOfLaunch } from "tle.js";
getIntDesignatorPieceOfLaunch(tle);
-> 'A'

getEpochYear(tle)

TLE epoch year (last two digits) when the TLE was generated.

  • Range: 00 to 99
import { getEpochYear } from "tle.js";
getEpochYear(tle);
-> 17

getEpochDay(tle)

TLE epoch day of the year (day of year with fractional portion of the day) when the TLE was generated.

  • Range: 1 to 365.99999999
import { getEpochDay } from "tle.js";
getEpochDay(tle);
-> 206.18396726

getEpochTimestamp(tle)

Unix timestamp (in milliseconds) when the TLE was generated (the TLE epoch).

import { getEpochTimestamp } from "tle.js";
getEpochTimestamp(tle);
-> 1500956694771

getFirstTimeDerivative(tle)

First Time Derivative of the Mean Motion divided by two, measured in orbits per day per day (orbits/day2). Defines how mean motion changes from day to day, so TLE propagators can still be used to make reasonable guesses when distant from the original TLE epoch.

  • Units: Orbits / day2
import { getFirstTimeDerivative } from "tle.js";
getFirstTimeDerivative(tle);
-> 0.00001961

getSecondTimeDerivative(tle)

Second Time Derivative of Mean Motion divided by six, measured in orbits per day per day per day (orbits/day3). Similar to the first time derivative, it measures rate of change in the Mean Motion Dot so software can make reasonable guesses when distant from the original TLE epoch.

Usually zero, unless the satellite is manuevering or in a decaying orbit.

  • Units: Orbits / day3
import { getSecondTimeDerivative } from "tle.js";
getSecondTimeDerivative(tle);
-> 0

Note: the original value in TLE is 00000-0 (= 0.0 x 100 = 0).

getBstarDrag(tle)

BSTAR drag term. This estimates the effects of atmospheric drag on the satellite's motion.

  • Units: EarthRadii-1
import { getBstarDrag } from "tle.js";
getBstarDrag(tle);
-> 0.000036771

Note: the original value in TLE is '36771-4' (= 0.36771 x 10-4 = 0.000036771).

getOrbitModel(tle)

Private value - used by the United States Space Force to reference the orbit model used to generate the TLE. Will always be seen as zero externally (e.g. by "us", unless you are "them" - in which case, hello!).

import { getOrbitModel } from "tle.js";
getOrbitModel(tle);
-> 0

getTleSetNumber(tle)

TLE element set number, incremented for each new TLE generated since launch. 999 seems to mean the TLE has maxed out.

  • Range: Technically 1 to 9999, though in practice the maximum number seems to be 999.
import { getTleSetNumber } from "tle.js";
getTleSetNumber(tle);
-> 999

getChecksum1(tle)

TLE line 1 checksum (modulo 10), for verifying the integrity of this line of the TLE. Note that letters, blanks, periods, and plus signs are counted as 0, while minus signs are counted as 1.

  • Range: 0 to 9
import { getChecksum1 } from "tle.js";
getChecksum1(tle);
-> 3

Note that this simply reads the checksum baked into the TLE string. Compare this with the computed checksum to ensure data integrity:

import { getChecksum1, computeChecksum } from "tle.js";
const expectedChecksum = getChecksum1(tle);
-> 3
const computedChecksum = computeChecksum(tle[1]);
-> 3
expectedChecksum === computedChecksum;
-> true

getInclination(tle)

Inclination relative to the Earth's equatorial plane in degrees. 0 to 90 degrees is a prograde orbit and 90 to 180 degrees is a retrograde orbit.

  • Units: degrees
  • Range: 0 to 180
import { getInclination } from "tle.js";
getInclination(tle);
-> 51.6400

getRightAscension(tle)

Right ascension of the ascending node in degrees. Essentially, this is the angle of the satellite as it crosses northward (ascending) across the Earth's equator (equatorial plane).

  • Units: degrees
  • Range: 0 to 359.9999
import { getRightAscension } from "tle.js";
getRightAscension(tle);
-> 208.9163

getEccentricity(tle)

Orbital eccentricity, decimal point assumed. All artificial Earth satellites have an eccentricity between 0 (perfect circle) and 1 (parabolic orbit).

  • Range: 0 to 1
import { getEccentricity } from "tle.js";
getEccentricity(tle);
-> 0.0006317

Note that the value in the original TLE is 0006317, with the preceding decimal point assumed (= 0.0006317).

getPerigee(tle)

Argument of perigee.

  • Units: degrees
  • Range: 0 to 359.9999
import { getPerigee } from "tle.js";
getPerigee(tle);
-> 69.9862

getMeanAnomaly(tle)

Mean Anomaly. Indicates where the satellite was located within its orbit at the time of the TLE epoch.

  • Units: degrees
  • Range: 0 to 359.9999
import { getMeanAnomaly } from "tle.js";
getMeanAnomaly(tle);
-> 25.2906

getMeanMotion(tle)

Revolutions around the Earth per day (mean motion).

  • Units: revs per day
  • Range: 0 to 17 (theoretically)
import { getMeanMotion } from "tle.js";
getMeanMotion(tle);
-> 15.54225995

getRevNumberAtEpoch(tle)

Total satellite revolutions when this TLE was generated. This number seems to roll over (e.g. 99999 -> 0).

  • Units: revs
  • Range: 0 to 99999
import { getRevNumberAtEpoch } from "tle.js";
getRevNumberAtEpoch(tle);
-> 6766

getChecksum2(tle)

TLE line 2 checksum (modulo 10) for verifying the integrity of this line of the TLE.

  • Range: 0 to 9
import { getChecksum2 } from "tle.js";
getChecksum2(tle);
-> 0

Note that this simply reads the checksum baked into the TLE string. Compare this with the computed checksum to ensure data integrity:

import { getChecksum2, computeChecksum } from "tle.js";
const expectedChecksum = getChecksum2(tle);
-> 0
const computedChecksum = computeChecksum(tle[2]);
-> 0
expectedChecksum === computedChecksum;
-> true

tle.js's People

Contributors

davidcalhoun avatar girish-io avatar mkrumpus avatar onekiloparsec avatar thkruz avatar timateus avatar tniessen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

tle.js's Issues

In cesuim, I want draw the orbit of the satellite, through tle.js

In cesuim, I want draw the orbit of the satellite, through tlejs.
cesuim can use Cesium.Cartesian3(x,y,z) or Cesium.Cartesian3.fromDegrees(longitude, latitude, height).
I can not get (x,y,z)!
I use the function getLatLngObj(tle, timestamp),can not get "height"!
How do I get the "height"?Help Me!

re-add support for commonJS?

Hello,

i have tried updating tle.js from 2.x.x to 3.x.x in a project of mine running on node v12.14.1 LTS, and it seems i cannot use anymore.

require() = cannot require ES modules
import() = error not supported (or self is not defined in tlejs.umd.js line 4 with experimental-modules enabled)
import x from = cannot import from outside of ES module

Do i have to rewrite my entire project into ES module syntax?

EDIT: i ended up renaming tlejs.umd.js to tlejs.umd.cjs in both the dist folder and in package.json to be able to use it

memory leak?

After calling getLatLngObj many times, node process size grows to the point where heap runs out of 2gb limit. I tried forcing gc() but that doesn't help. Perhaps a memory leak? Same thing on OSX and also on ubuntu.

I'm talking calling it a couple of million times (30 minutes, get it per second, over 1800 unique TLEs) and the process of using all the heap takes a few minutes.

Maybe ground track would avoid this? but I want to know position of all things at time T, not store position of all things at time T..T1, then take vertical slices of a large array.

Am not up to speed with heap memory use in node to diagnose further, sorry.

1: getSatelliteInfo(aka getSatelliteInfo) [0x1a08ab643c51] [/node_modules/tle.js/dist/tlejs.cjs:~1147] [pc=0x6183a988fca](this=0x1a08e6e804b1 <undefined>,0x1a0820cceb19 <String[#153]\: STARLINK-1673\n1 46327U 20062C   21296.50839213 -.00000375  00000-0 -63012-5 0  9997\n2 46327  53.0562 351.1412 0001137  89.3252 270.7867 15.06393643 63...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
1: 0x1011d1c65 node::Abort() (.cold.1) [/usr/local/bin/node]
2: 0x10009f919 node::Abort() [/usr/local/bin/node]
3: 0x10009fa7f node::OnFatalError(char const*, char const*) [/usr/local/bin/node]

getGroundTracks isn't generating points all the way to the antemeridian

The TLE I am using is:

(from https://celestrak.org/NORAD/elements/)

Yaogan 30-3-1
1 43081U 17085A   23255.08539617  .00003307  00000-0  31592-3 0  9999
2 43081  34.9957 136.4707 0003991 355.2856   4.7811 14.92839335311372

stepMS was set to 10000
startTimeMS was set to 1698152211870

The final coordinates were:

first track - ( 168.64888285189693, 23.240111501597084 )
second track - ( 166.54109672164154, 9.207423700081948 )
third track - ( 165.9980830743187, -8.892570482834437 )

I tried setting stepMS to 100, for example, but the behavior was the same.

My expectation was for the track coordinates to end somewhere close to 180.

Invalid result from checking parsedTLE against "isTLEObj"

In /src/index.d.ts, ParsedTLE is defined as having tle, a two-element array, and optionally a name.

    /**
     * Output of parseTLE().  TLE normalized into a predictable format for fast lookups.
     */
    export interface ParsedTLE {
        /**
         * Satellite name (only extracted from 3-line TLE inputs).
         * @default "Unknown"
         */
        name?: string,
        /** Two-line TLE. */
        tle: [TLELine, TLELine]
    }

However, in /src/parsing.js, the function isTLEObj checks if the parsed TLE object has a name and returns false if it doesn't.

export function isTLEObj(obj) {
	return (
		typeof obj === _DATA_TYPES._OBJECT &&
		obj.name &&
		obj.tle &&
		getType(obj.tle) === _DATA_TYPES._ARRAY &&
		obj.tle.length === 2
	);
}

This is a discrepancy between the two, which became an issue for me when using an unnamed TLE in getGroundTracks. Namely, getGroundTracks parses the TLE using parseTLE(), however because my provided TLE is a 2-line one, it returns an object without name property ({ tle: [..., ...] }) which is a valid TLE according to the type definition but not according to the isTLEObj() checker. Thus getGroundTracks returns an error.

This seems like an easy fix, but not sure what is the desired solution. My suggestion would be to have parseTLE() always return an object with both name and tle properties, and make ParsedTLE type definition have name not as optional but as required. Alternatively I'd suggest to change the isTLEObj check for obj.name. At the moment this also returns false if name is an empty string. However I can't foresee if either of these would create issues for others.

I can open a PR with that fix if desired. For now a workaround would be to write my own ParseTLE that just appends the name property.

How to get range sat?

Hello and thank you for this cool library ☺️
I need to get rangeSat on every position change of satellite , so how can i get this?

Nest.js: Unable to import

Problem

Compilation fails when using tle.js with nest.js:

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: <redacted>/node_modules/tle.js/dist/tlejs.umd.js
require() of ES modules is not supported.
require() of <redacted>/node_modules/tle.js/dist/tlejs.umd.js from <redacted>/dist/services/spacecraft-data.service.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename tlejs.umd.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from <redacted>/node_modules/tle.js/package.json.

    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1089:13)
    at Module.load (internal/modules/cjs/loader.js:937:32)
    at Function.Module._load (internal/modules/cjs/loader.js:778:12)
    at Module.require (internal/modules/cjs/loader.js:961:19)
    at require (internal/modules/cjs/helpers.js:92:18)
    at Object.<anonymous> (<redacted>/src/services/spacecraft-data.service.ts:5:1)
    at Module._compile (internal/modules/cjs/loader.js:1072:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
    at Module.load (internal/modules/cjs/loader.js:937:32)
    at Function.Module._load (internal/modules/cjs/loader.js:778:12)

Workaround

Remove the "type": "module", line from the package.json

Solution

I don't know (yet). Maybe remove the line and everything would be fine? Or does that cause other problems?

README states order of LngLat twice in the same way

In the README section describing the ground track code, it says:

// Returns points in [lng, lat] order when true, and [lng, lat] order when false.
  isLngLatFormat: true

However, the two orders are the same here ([lng, lat] and [lng, lat])

Caching based on Satellite name causes incorrect return values

In some cases there are satellites listings with different TLEs but that have the same name (for instance, the ISS debris is all reported with a name of ISS DEB).

If you use the 3 element syntax in the library which includes the satellite name, you will get incorrect results once the entity has been parsed once. For example:

const issDebris1 = [
  'ISS DEB',
  '1 44303U 98067QA  20168.11979959  .00002872  00000-0  50277-4 0  9995',
  '2 44303  51.6421 345.5785 0004933 328.2807  31.7886 15.54325834 59558',
];

const issDebris2 = [
  'ISS DEB',                 
  '1 44304U 98067QB  20168.07956297  .00014700  00000-0  17368-3 0  9997',
  '2 44304  51.6395 337.0565 0003893 303.8223  56.2400 15.61553656 59676'
];

getCatalogNumber(issDebris1); // 44303
getCatalogNumber(issDebris2); // 44303 (should be 44304)

Not a huge deal, since an easy enough work around is to just omit the name element.

getVisibleSatellites return empty array

Hi,

I am trying to use TLE.js and everything was going quite well until I tried to use getVisibleSatellites. I am using spacetrack npm module to retrieve the most recent TLEs of certain satellites (all the SkySat ones) which then put in an array which therefore becomes of an array of arrays :

[
[
 '0 SKYSAT C12',
 '1 43797U 18099AR  20029.52879878 +.00000391 +00000-0 +19261-4 0  9990',
 '2 43797 097.3805 103.0646 0003500 182.3187 177.8034 15.23559221063758'
]
[
 '0 SKYSAT C13',
 '1 43802U 18099AW  20029.48568984 +.00000420 +00000-0 +20441-4 0  9990',
 '2 43802 097.3802 103.5570 0006225 141.4162 218.7521 15.23646196063618'
]
]

Then I try fill the function with the correct parameters :

tle.getVisibleSatellites({
      observerLat: 37.614740,
      observerLng: 34.533634,
      tles: arrayOfArrays,
      timestampMS: startingDate
    });

And the result is an empty array. I tried iterating through a one week timestamp every 30 seconds but still the exact same and I can't find a proper solution.

Am I doing something wrong ?

Accuracy of AZ and EL

Currently looking at some output and it appears the look angles are several degrees off other sources. Curious if there is something else that I need to handle, or if I'm doing something incorrectly.

var tleArr = [
    line1,
    line2
]

var observer = {
    lat: myLat,
    lng: myLng,
    height: myHeight
}
var timestampMS = (new Date).getTime()
var satInfo = tle.getSatelliteInfo(
    tleArr,
    timestampMS,
    observer.lat,
    observer.lng,
    observer.height
)

console.log("AZ: "+satInfo.azimuth)
console.log("EL:"+satInfo.elevation)

the satellite initially reviewing shows 156.2(true)&152.4*(magn)* on other sources (within a few decimals between sources) whereas I am getting 158*. I am also seeing the elevation on other sources show ~51.2* with this code returning 46.5*.

The inclination is 4.7707. Unsure if I need to take any other aspects into account to align things up properly.

getGroundTracks returning strange values randomly; sometimes tracks equal each other or are completely wrong

Say I use the following code to get a ground track and print the result:

const satInfo = await getGroundTracks({
      tle: satTLE,
      stepMS: 10000,
      isLngLatFormat: false
    })
console.log(satInfo[0][550]) // Choosing 550 as the index to be consistent
console.log(satInfo[1][550])
console.log(satInfo[2][550])

Sometimes, the results will make sense in that each array has different values, like this:

image

And the satellite's current position (using getLatLngObj()) on a map will lie on ground track [1].

image

But quite often, for no discernible reason (after refreshing or whatever), some of the arrays will be equal to each other.

image

And the satellite's position will no longer lie on the plotted line for that orbit!

image

And sometimes, the values will be completely off everywhere:

image

Changing the startTimeMS does not fix this; nor does changing the TLE, or changing stepMS. I have a hunch that this may be due to something with inclined orbits (TLEs with higher inclinations having more problems) but I have no real way to confirm this because I can't replicate the conditions that explicitly cause it to happen.

getEpochTimestamp returning NaN

When I use the getEpochTimestamp function it returns a NaN. All other get functions are working as expected.

function convertTLE(tle) { const satelliteData = { name: getSatelliteName(tle), semiMajorAxis: getSemiMajorAxis(getMeanMotion(tle)), eccentricity: getEccentricity(tle), inclination: getInclination(tle), rightAscension: getRightAscension(tle), perigee: getPerigee(tle), meanAnomaly: getMeanAnomaly(tle), epoch: getEpochTimestamp(tle), }; console.log(getEpochTimestamp(tle)); return satelliteData; }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.