2.1.3 • Published 5 years ago

spacetrack v2.1.3

Weekly downloads
9
License
MIT
Repository
github
Last release
5 years ago

Space Track

Build Status

Simple node.js library for the Space-Track.org REST API.

You need login credentials for Space-Track. Available upon request and approval here.

API

This project follows semver principles.

Login

var spacetrack = require('spacetrack');
spacetrack.login({
  username: 'yourusername',
  password: 'yourpassword'
});

Request

This will build a request from the provided options and return a promise.

var promise = spacetrack.get(options);
options = {
  controller: 'basicspacedata', // defaults to 'basicspacedata'
  action: 'query', // defaults to 'query'

  type: 'tle_latest', // required, must be one of the following:
  // tle, tle_latest, tle_publish, omm, boxscore, satcat,
  // launch_site, satcat_change, satcat_debut, decay, tip, csm

  query: [  // optional, but highly recommended
    {field: 'NORAD_CAT_ID', condition: '25544'} // e.g. (see the API documentation)
  ],

  predicates: [  // optional
    'NORAD_CAT_ID', 'ORDINAL'
  ],

  favorites: [  // optional
    'Navigation'
  ],

  orderby: [  // optional
    '+ORDINAL', // ascending by ORDINAL
    '-NORAD_CAT_ID' // descending by NORAD_CAT_ID
  ],

  limit: 100, // optional, but recommended
  offset: 10, // optional (needs limit to be set, otherwise limit defaults to 100)

  distinct: false // optional (this option causes some hiccups)
}

For more information on the options consult the Space-Track API Documentation.

Example

This is a basic example to get the latest ephemerides of satellites 25544 (ISS) and 39166 (USA 242).

var spacetrack = require('spacetrack');
var util = require('util');

spacetrack.login({
  username: 'username',
  password: 'password'
});

spacetrack.get({
  type: 'tle_latest',
  query: [
    {field:'NORAD_CAT_ID', condition: '25544,39166'},
    {field:'ORDINAL', condition: '1'},
  ],
  predicates: [
    'OBJECT_NAME',
    'EPOCH',
    'INCLINATION',
    'ARG_OF_PERICENTER',
    'RA_OF_ASC_NODE',
    'MEAN_ANOMALY',
    'ECCENTRICITY',
    'MEAN_MOTION'
  ]
})
.then(function(result) {
  console.log( util.inspect(result, {colors: true, depth: null}) );
}, function(err) {
  console.error('error', err.stack);
});

Result:

[ { name: 'ISS (ZARYA)',
    epoch: '2014-11-30 14:05:20Z',
    eccentricity: '0.0007404',
    inclination: '51.6481',
    rightAscension: '354.5641',
    argPericenter: '83.5665',
    meanAnomaly: '60.4119',
    meanMotion: '15.51651628' },
  { name: 'NAVSTAR 68 (USA 242)',
    epoch: '2014-11-30 04:42:49Z',
    eccentricity: '0.001521',
    inclination: '55.3151',
    rightAscension: '77.3669',
    argPericenter: '9.0755',
    meanAnomaly: '350.9483',
    meanMotion: '2.00562695' } ]
2.1.3

5 years ago

2.1.2

5 years ago

3.0.0-alpha.5

8 years ago

3.0.0-alpha.4

8 years ago

3.0.0-alpha.3

8 years ago

3.0.0-alpha.2

8 years ago

3.0.0-alpha.1

8 years ago

3.0.0-alpha

8 years ago

2.1.1

9 years ago

2.1.0

9 years ago

2.0.1

9 years ago

2.0.0

9 years ago

1.0.0

9 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago