ootk is a collection libraries for doing math related to orbital objects written in TypeScript. ootk was
developed to simplify the math and let you focus on using the results.
Most of the functionality was originally written for KeepTrack and then
later refactored into this library for others to use.
import { DetailedSatellite, DetailedSensor, Degrees, Kilometers, SpaceObjectType, TleLine1, TleLine2 } from "ootk";
// Using api.keeptrack.space API
fetch('https://api.keeptrack.space/v1/sat/25544')
.then((res) => res.json())
.then((satData) => {
const satellite = new DetailedSatellite({
id: satData.id,
tle1: satData.tle1 as TleLine1,
tle2: satData.tle2 as TleLine2,
});
// Get the satellite's position at the current time
const eci = satellite.eci();
// Log the satellite's position - y component only
console.log(eci.position.y);
// Access other satellite properties
console.log(satellite.inclination); // inclination in degrees
console.log(satellite.eccentricity); // eccentricity
console.log(satellite.period); // period in minutes
// Get LLA (Latitude, Longitude, Altitude)
const lla = satellite.lla();
console.log(lla); // { lat: degrees, lon: degrees, alt: kilometers }
const sensor = new DetailedSensor({
lat: 41.754785 as Degrees,
lon: -70.539151 as Degrees,
alt: 0.060966 as Kilometers,
minAz: 347 as Degrees,
maxAz: 227 as Degrees,
minEl: 3 as Degrees,
maxEl: 85 as Degrees,
minRng: 0 as Kilometers,
maxRng: 5556 as Kilometers,
name: 'Cape Cod',
type: SpaceObjectType.PHASED_ARRAY_RADAR,
});
// Assuming we have a satellite object from the previous example
const rae = sensor.rae(satellite);
// Log the azimuth from sensor to satellite
console.log(rae.az);
// Check if a satellite is in the sensor's field of view right now
const isSatInFov = sensor.isSatInFov(satellite);
console.log(isSatInFov); // true or false
// Calculate passes for a satellite (in 30 second intervals)
const passes = sensor.calculatePasses(30, satellite);
console.log(passes); // Array of pass information
// Convert sensor position to J2000 coordinates
const j2000 = sensor.toJ2000();
console.log(j2000); // J2000 object with position and velocity
});
Documentation
New to OOTK? Check out our comprehensive documentation:
Getting Started Guide - Perfect for beginners! Learn the basics with step-by-step tutorials
User Guide - Complete reference for all features and advanced capabilities
Make sure that your changes don’t break the existing code by running:
npm test
Check that your code follows the rules established in eslint.rc:
npm run lint
:man_scientist: Contributors
This whole project is an example of standing on the shoulder’s of giants. None of it would have been possible without
the previous work of the following:
I have placed the code under the AGPL License in order to ensure that good ideas can be shared and that
the code is open for everyone to use. Learn more here.
关于
Orbital Object Toolkit:卫星轨道工具库(SGP4/TLE 解析、几何计算),KeepTrack 生态基础库。镜像收录自 https://github.com/thkruz/ootk,License:AGPL-3.0
ootk
ootk is a collection libraries for doing math related to orbital objects written in TypeScript. ootk was developed to simplify the math and let you focus on using the results.
Most of the functionality was originally written for KeepTrack and then later refactored into this library for others to use.
🔧 Installation
Install the library with NPM:
Example Usage
New to OOTK? Check out our comprehensive documentation:
The documentation covers:
:desktop_computer: Building
Install Node.js and Node Package Manager;
Install all required packages with NPM by running the following command from repository’s root directory:
Run the following NPM script to build everything:
buildcompiles TypeScript into ES6 Modules and combines them into a single file in thedistdirectory.lintlints source code located insrcdirectory with ESLintlint:fixlints tests located insrcdirectory with ESLint and attempts to auto-fix errorslint:testlints tests located intestdirectory with ESLinttestruns jest to verify code remains functionaltest:coveragegenerates lcov report to view code coverage:man_teacher: Contributing
This repo follows Gitflow Workflow.
Before starting a work on new pull request, please, checkout your feature or bugfix branch from
developbranch:Make sure that your changes don’t break the existing code by running:
Check that your code follows the rules established in eslint.rc:
:man_scientist: Contributors
This whole project is an example of standing on the shoulder’s of giants. None of it would have been possible without the previous work of the following:
:balance_scale: License
I have placed the code under the AGPL License in order to ensure that good ideas can be shared and that the code is open for everyone to use. Learn more here.