libgs_ops.propagator.SpaceTrackAPI.query_tle

SpaceTrackAPI.query_tle(params)[source]

Perform a (fairly) raw query to the spacetrack API for the most recent three-line-elements.

Parameters:params (dict) – A dictionary of parameter/argument pairs that specify the exact query to make.

Note

This function will always return three-line-elements. I.e. the param pairs are added to the API URI “/basicspacedata/query/class/tle_latest/format/3le/ORDINAL/1”

Parameter syntax

See spacetrack for the most up-to-date descripions of the possible parameter/value pairs.

Each entry in the param dict follows key:value as per the model definition. For the latest model definition see here.

Field Type
ORDINAL tinyint(3) unsigned
COMMENT varchar(32)
ORIGINATOR varchar(5)
NORAD_CAT_ID mediumint(8) unsigned
OBJECT_NAME varchar(60)
OBJECT_TYPE varchar(11)
CLASSIFICATION_TYPE char(1)
INTLDES varchar(8)
EPOCH datetime
EPOCH_MICROSECONDS mediumint(8) unsigned
MEAN_MOTION double
ECCENTRICITY double
INCLINATION double
RA_OF_ASC_NODE double
ARG_OF_PERICENTER double
MEAN_ANOMALY double
EPHEMERIS_TYPE tinyint(3) unsigned
ELEMENT_SET_NO smallint(5) unsigned
REV_AT_EPOCH float
BSTAR double
MEAN_MOTION_DOT double
MEAN_MOTION_DDOT double
FILE int(10) unsigned
TLE_LINE0 varchar(62)
TLE_LINE1 char(71)
TLE_LINE2 char(71)
OBJECT_ID varchar(11)
OBJECT_NUMBER mediumint(8) unsigned
SEMIMAJOR_AXIS double(20,3)
PERIOD double(20,3)
APOGEE double(20,3)
PERIGEE double(20,3)

The following operators can be used with the values

Operator Description
> Greater Than (alternate is %3E)
< Less Than (alternate is %3C)
<> Not Equal (alternate is %3C%3E)
, Comma Delimited ‘OR’ (ex. 1,2,3)
Inclusive Range (ex. 1--100 returns 1 and 100 and everything in between). Date ranges are expressed as YYYY-MM-DD%20HH:MM:SS--YYYY-MM-DD%20HH:MM:SS or YYYY-MM-DD--YYYY-MM-DD
null-val Value for ‘NULL’, can only be used with Not Equal (<>) or by itself.
~~ “Like” or Wildcard search. You may put the ~~ before or after the text; wildcard is evaluated regardless of location of ~~ in the URL. For example, ~~OB will return ‘OBJECT 1’, ‘GLOBALSTAR’, ‘PROBA 1’, etc.
^ Wildcard after value with a minimum of two characters. (alternate is %5E) The wildcard is evaluated after the text regardless of location of ^ in the URL. For example, ^OB will return ‘OBJECT 1’, ‘OBJECT 2’, etc. but not ‘GLOBALSTAR’
now Variable that contains the current system date and time. Add or subtract days (or fractions thereof) after ‘now’ to modify the date/time, e.g. now-7, now+14, now-6.5, now+2.3. Use <,>,and – to get a range of dates; e.g. >now-7, now-14--now

You can also specify to order results by a specific field by using they

Examples:

>>> query_tle({'PERIOD': '<128'})
Satellites currently in Low Earth Orbit (LEO = <2000KM altitude).
>>> query_tle({'PERIOD':'1430--1450', 'orderby':'NORAD_CAT_ID'})
Satellites in geosynchronous orbit 1430 <= period <= 1450 minutes.
Sort results by Norad ID.