Skip to content

stevenpaligo/spacetrack-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Space-Track Client

This project is a Java client for querying space data (satellites, two-line element sets, etc.) from the "basicspacedata" controller of the Space-Track.org REST API. It uses builder objects to construct queries and automatically deserializes the results into convenient data model objects.

Maven Central Javadoc License

Getting Started

Prerequisites

Space-Track Client requires Java 8+ and uses SLF4J for logging.

Installation

To include Space-Track Client in a Maven project, add the following dependency:

<dependencies>
  ...
  <dependency>
    <groupId>com.stevenpaligo</groupId>
    <artifactId>spacetrack-client</artifactId>
    <version>${spacetrack-client.version}</version>
  </dependency>
  ...
</dependencies>

For non-Maven projects, download the JAR from Maven's Central Repository. The list of dependencies can be found in the pom.xml file (see the source on GitHub)

Usage

The following is a quick "Hello World" example of querying data. The example queries the Satellite Catalog (a.k.a. SatCat) for the International Space Station's data and prints out its apogee height.

/*
   Query for the International Space Station's satellite record (catalog number 25544). Start by
   instantiating the query class that represents Space-Track.org's "request class" (SatCatQuery, TleQuery,
   etc.). Next, set the query's credentials. Then set any predicates, limits, sorting, etc. that
   define how the query functions. In this example, the query is searching for the satellite whose catalog
   number is equal to 25544. Finally, call the `execute()` method to run the query and return results as
   deserialized data model objects.
*/
List<SatCat> results = new SatCatQuery().setCredentials("<user>", "<password>")
  .equal(SatCatQueryField.CATALOG_NUMBER, 25544).execute();


/*
   Print out the apogee height
*/
SatCat internationalSpaceStation = results.get(0);

if (internationalSpaceStation.getApogeeHeightKilometers().isPresent()) {

  long apogeeHeightKm = internationalSpaceStation.getApogeeHeightKilometers().get();
  System.out.println("The International Space Station's apogee height is: " + apogeeHeightKm + " km");

} else {

  System.out.println("The International Space Station's apogee height is: unknown");
}

See the JavaDoc for more information.

Contributions

Contributions (bug reports, feature requests, etc.) are always welcome and should be coordinated through the GitHub Issues system.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the Apache License Version 2.0. See the license file file for details.