AstroWatch.SpaceTrack
1.1.2
dotnet add package AstroWatch.SpaceTrack --version 1.1.2
NuGet\Install-Package AstroWatch.SpaceTrack -Version 1.1.2
<PackageReference Include="AstroWatch.SpaceTrack" Version="1.1.2" />
<PackageVersion Include="AstroWatch.SpaceTrack" Version="1.1.2" />
<PackageReference Include="AstroWatch.SpaceTrack" />
paket add AstroWatch.SpaceTrack --version 1.1.2
#r "nuget: AstroWatch.SpaceTrack, 1.1.2"
#:package AstroWatch.SpaceTrack@1.1.2
#addin nuget:?package=AstroWatch.SpaceTrack&version=1.1.2
#tool nuget:?package=AstroWatch.SpaceTrack&version=1.1.2
AstroWatch.SpaceTrack
AstroWatch.SpaceTrack is a .NET SDK designed to integrate with the SpaceTrack API, simplifying access to satellite data, orbital elements, and space debris tracking. This SDK allows developers to seamlessly interact with the SpaceTrack API to build space-related applications with ease.
Features
- Retrieve satellite catalog data, orbital elements, and TLE (Two-Line Element) sets.
- Perform satellite position and tracking queries.
- Query launch and decay events for space objects.
- Support for API authentication.
Installation
To install AstroWatch.SpaceTrack via NuGet:
dotnet add package AstroWatch.SpaceTrack
Alternatively, you can install it using the NuGet Package Manager in Visual Studio by searching for AstroWatch.SpaceTrack
.
Getting Started
The SDK consist of two main clients: the public client and the restricted client. Public client facilitates access to the publicly available SpaceTrack data "Classes" and the restricted client does the same for restricted ones. To learn more about space track API concepts visit Introduction to the API - SpaceTrack.org
The public classes are end-to-end tested but the restricted ones are not simply because I don't have access to them. I would encourage anyone with access to those endpoints to contribute to this repository by testing and extending the SDK.
You can initialize the SDK in two ways:
Using Dependency Injection
- Add the following json property to appsettings.json:
"SpaceTrackSettings": {
"Username": "YOUR_USERNAME",
"Password": "YOUR_PASSWORD"
}
- Register the configurations and SpaceTrackSDK services to the ServiceCollection. Bellow is an example of how it's done in an ASP.NET core application's Program.cs file:
using AstroWatch.SpaceTrack;
using AstroWatch.SpaceTrack.Extensions.DependencyInjection;
var builder = WebApplication.CreateBuilder(args);
// Register the configurations
builder.Services.Configure<SpaceTrackSettings>(builder.Configuration.GetSection(SpaceTrackSettings.SectionName));
// Register SpaceTrack services
builder.Services.AddSpaceTrack();
builder.Services.AddMvc();
builder.Services.AddOptions();
builder.Services.AddControllers();
var app = builder.Build();
app.UseHttpsRedirection();
app.MapControllers();
app.Run();
- Inject the client(s) to your application classes:
private ISpaceTrackPublicClient _spaceTrackPublicClient;
// If needed:
// private ISpaceTrackRestrictedClient _spaceTrackRestrictedClient;
public TestController(ISpaceTrackPublicClient spaceTrackPublicClient)
{
_spaceTrackPublicClient = spaceTrackPublicClient;
}
Without Dependency Injection
To access the SpaceTrack API, you need a valid account on SpaceTrack.org. Once you have your credentials, authenticate as follows:
using AstroWatch.SpaceTrack;
var authenticator = new SpaceTrackAuthenticator(new SpaceTrackSettings("YOUR_USERNAME", "YOUR_PASSWORD"));
var spaceTrackPublic = new SpaceTrackPublicClient(authenticator);
// *** if needed, this is how you can also instanciate the restricted client
// var spaceTrackRestricted = new SpaceTrackRestrictedClient(authenticator);
Fetching Data
To get data from space track you should simply follow the pattern below:
await SpaceTrackClient
.Class
[.FilterOn(c ⇒ c.PredicateName).Operator(Value or Condition)]
[.FilterOn(c ⇒ c.PredicateName).Operator(Value or Condition)]
...
.GetAsSomeFormatAsync();
Below you can see a few examples of how different types of data are queried:
//Store the whole decay history in a csv file
await spaceTrack.Decay.GetAsCsvAsync("DecayData.csv");
//Get updates from the past 10 days for objects in LEO in TLE string format
var updatesForLeoObjectsInPastTenDays = await spaceTrack.GeneralPerturbations
.FilterOn(p => p.MeanMotion)
.IsGreaterThan(11.25)
.FilterOn(p => p.Epoch)
.IsGreaterThan(PredicateValue.FromNumberOfDaysAgo(10))
.GetAsTleStringAsync();
//Get updates from the past 10 days for objects in GEO desrialized as a list of TLE data objects
var updatesForGeoObjectsInPastTenDays = await spaceTrack.GeneralPerturbations
.FilterOn(p => p.MeanMotion)
.IsBetween(0.99, 1.01)
.FilterOn(p => p.Eccentricity)
.IsLessThan(0.01)
.GetAsTleDataAsync();
//Get a list of all decayed satellites deserialized as a list of objects
var decayedSatellites = await spaceTrack.SatelliteCatalog
.FilterOn(s => s.DecayDate)
.IsNotNull()
.GetAsDeSerializedListAsync();
Contributing
We welcome contributions! If you'd like to contribute, please fork the repository and submit a pull request.
Contact
For any inquiries or support, feel free to reach out via milad665@gmail.com.
Happy Coding! 🚀
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.0-rc.1.24431.7)
- Microsoft.Extensions.DependencyInjection (>= 9.0.0-rc.1.24431.7)
- Microsoft.Extensions.Options (>= 7.0.1)
- System.Text.Json (>= 9.0.0-rc.1.24431.7)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
1.1.2 | 119 | 9/25/2024 |
1.1.1 | 86 | 9/24/2024 |
1.1.1-alpha.0.1 | 73 | 9/24/2024 |
1.0.0 | 83 | 9/23/2024 |
Initial release of AstroWatch.SpaceTrack.