about summary refs log tree commit diff
path: root/tle.go
diff options
context:
space:
mode:
Diffstat (limited to 'tle.go')
-rw-r--r--tle.go133
1 files changed, 133 insertions, 0 deletions
diff --git a/tle.go b/tle.go
new file mode 100644
index 0000000..95b0a55
--- /dev/null
+++ b/tle.go
@@ -0,0 +1,133 @@
+/*
+Package tle implementing the "Two-line element set (TLE)", a data format encoding orbital elements of Earth-orbiting objects.
+
+More information can be found in the wikipedia article: (https://en.wikipedia.org/wiki/Two-line_element_set) and in the official NASA documentation: (https://spaceflight.nasa.gov/realdata/sightings/SSapplications/Post/JavaSSOP/SSOP_Help/tle_def.html)
+
+*/
+package tle
+
+// TLE defines the lines contained in a Two-Line-Element
+type TLE struct {
+	TitleLine TitleLine `json:"titleline"`
+	LineOne   LineOne   `json:"lineone"`
+	LineTwo   LineTwo   `json:"linetwo"`
+}
+
+// TitleLine defines the first line in the the TLE
+// It contains the name of the satellite
+type TitleLine struct {
+	Satname string `json:"satname"`
+}
+
+// LineOne defines the first line in the TLE
+type LineOne struct {
+	Linenumber int `json:"linenumber"`
+
+	// Catalog number defined by USSPACECOM
+	// A "U" indicates an unclassified object
+	SatelliteNumber int    `json:"satellitenumber"`
+	Classification  string `json:"classification"`
+
+	// International  Designator containing information about the launch
+	InternationalDesignator InternationalDesignator `json:"internationaldesignator"`
+
+	// Epoch defining from when the TLE is
+	Epoch Epoch `json:"epoch"`
+
+	// First Time Derivative of the Mean Motion divided by two
+	// Unit: revs / day
+	// "catch all" drag term used in SGP4 USSPACECOM predictor
+	Firstderiv float64 `json:"firstderiv"`
+
+	// Second Time Derivative of Mean Motion divided by six (decimal point assumed)
+	// second order drag term in the SGP4
+	// Unit: revs / day^3
+	// A leading decimal must be applied to this value
+	// The last two characters define an applicable power of 10 (12345-5 = 0.0000012345)
+	Secondderiv float64 `json:"secondderiv"`
+
+	// Drag Term
+	// (67960-4 = 0.000067960)
+	// Unit: earth radii^-1
+	// The last two characters define an applicable power of 10
+	BSTAR float64 `json:"BSTAR"`
+
+	// The number 0 (originally this should have been "Ephemeris type")
+	Numberzero int `json:"numberzero"`
+
+	// Element set number. Incremented when a new TLE is generated for this object.
+	ElementSetNumber int `json:"elementesetnumber"`
+
+	// Checksum (modulo 10)
+	Checksum int `json:"checksum"`
+}
+
+// InternationalDesignator stores information about the satellite such as when it launched
+type InternationalDesignator struct {
+
+	// Last two digits of launch year
+	Launchyear int `json:"launchyear"`
+
+	// Launch number of the year
+	Launchnumber int `json:"launchnumber"`
+
+	// Piece of the launch
+	Launchpiece string `json:"launchpiece"`
+}
+
+// Epoch defines a moment in time
+type Epoch struct {
+
+	// Last two digits of the year
+	Year int `json:"year"`
+
+	// day of the year and fractional portion of the day
+	Dayfraction float64 `json:"dayfraction"`
+}
+
+// LineTwo of the TLE
+type LineTwo struct {
+	Linenumber int `json:"linenumber"`
+
+	// Catalog number defined by USSPACECOM
+	SatelliteNumber int `json:"satellitenumber"`
+
+	// Inclination
+	// Unit: degrees
+	// Angle between the equator and the orbit plane
+	Inclination float64 `json:"inclination"`
+
+	// Right Ascension of the Ascending Node
+	// Unit: degrees
+	// Angle between vernal equinox and the point where the orbit crosses the equatorial plane (going north).
+	RightAscensionOfTheAscendingNode float64 `json:"rightascensionoftheascendingnode"`
+
+	// Eccentricity
+	// Constant defining the shape of the orbit (0=circular, Less than 1=elliptical).
+	// The value provided is the mean eccentricity.
+	// A leading decimal must be applied to this value
+	Eccentricity float64 `json:"eccentricity"`
+
+	// Argument of perigee
+	// Unit: degrees
+	// The angle between the ascending node and the orbit's point of closest approach of the earth (perigee)
+	ArgumentOfPerigee float64 `json:"argumentofperigee"`
+
+	// Mean Anomaly
+	// Unit: degrees
+	// The angle, measured from perigee, of the satellite location in the orbit referenced to a circular orbit
+	// with radius equal to the semi-major axis.
+	MeanAnomaly float64 `json:"meananomaly"`
+
+	// Mean Motion
+	// The value is the mean number of orbits per day the object completes. There are 8 digits after the decimal,
+	// leaving no trailing space(s) when the following element exceeds 9999.
+	MeanMotion float64 `json:"meanmotion"`
+
+	// The orbit number at Epoch Time. This time is chosen very near the time of true ascending node passage as
+	// a matter of routine. The last digit is the check sum for line 2.
+	RevolutionNumberAtEpoch int `json:"revolutionnumberatepoch"`
+
+	// Checksum (modulo 10)
+	Checksum int `json:"checksum"`
+}