For a side project I’m doing, I needed to be able to find out the historical position (as a latitude/longitude) of the International Space Station. Given the number of ISS tracker sites available, I’d hoped there would be an API somewhere for it. However, after much searching, I couldn’t find a single one (Wolfram Alpha’s website will give you the info, but you can’t get at the info using their API and even if you could, their terms don’t let you store the data).

Given that I needed to build something to calculate the information, I thought I may as well also publish it as a freely available API – hopefully it may save someone some work.

How it works

NORAD publishes data for earth orbiting objects which you can use to calculate their positions. The data comes in the form of TLE’s which (if you sign up for an account) you can retrieve from an api at space-track.org (if you are old-school you can use a Nasa JPL telnet interface to query their database) . Once you have a TLE you can calculate positions from it using a public domain algorithm. Each TLE is only accurate for a point in time – so as you get further away from that time, your prediction will be further out. (around 3km’s error after 24 hours) For this reason the TLE’s are published several times a day.

The api works by maintaining a database of all of the published TLE’s for the ISS since late 1998 up until the present time. When you make a request the api finds the nearest valid TLE and then uses that to make its calculations. Thankfully the astro-physics number-crunching side of things is handled by a library .

API details

You can access the api as follows…

http://jimanning.com/issapi/?unixts=1359548643

…where unixts is a Unix Epoch time in seconds. if you omit the unixts then it will return the current position of the ISS. If you specify a time in the future, it will still make a calculation, but it won’t be accurate.

You will get back something along the lines of…

{
"status":"ok",
"request":{"ts":1146446446},
"contact":"Jim Anning @JimAnning",
"tle":{"epoch":"1146440185","timeSince":1.73916666667},
"position":{"lat":51.4631650902,"lon":-70.1261097654,"alt":346.66104884,"vel":7.70831133728}
}

The tle term will give you the epoch time that the selected TLE was valid for and the number of hours between the TLE time and the time you requested.

The position term will give you the latitude, longitude, altitude (in km’s) and velocity (in km/s) of the ISS at any given time.

 

 

 

 

Trackback

no comment until now

Add your comment now