Where is the ISS at? Getting data off the REST API.

by Penny Richmond

We’re going to learn how to use the “Where is the ISS at?” REST API and Alteryx to find out the recent locations of the International Space Station.

The documentation can be found here: https://wheretheiss.at/w/developer.

Start by deciding on your time interval. I want to find out where the ISS has been since I've been sitting at my desk, so from 9am until midday today. Use a text input tool and pop your start time and date and end time and date into Alteryx in separate columns like so:

Generate all your timestamps (the times at which you want to download data for) using the Generate Rows tool. In this case we are finding a timestamp for every minute of our time interval so our configuration looks like this:

Creating our timestamps with 1 minute intervals

The ISS operates in UNIX time. UNIX time is an alternative system of time: it is the number of seconds that have elapsed since the Unix epoch, the arbitrary time and date of: 00:00:00 UTC on 1 January 1970. We can do this using DateTimeDiff, using the Unix epoch as our initial datetime and each of our timestamps as the end datetime.  

Let’s put the Unix epoch as a third column in our text input tool so that we can easily refer to this as BaseTimeDate in our formula tool.

Adding the BaseDate (Unix Epoc) to the text imput tool.

Insert another text input tool and put in the base URL for the API:

Use Append Fields tool to create a column that sticks the base URL onto every row of our dataset.

We are now going to use the formula tool to stick our timestamps onto the base URL + the call for positions, and put our units on the end. The formula we need is:

[BASE URL]+'/positions?timestamps='+[UNIX TimeStamp]+'2&units=miles'

We make a request to the API and download the JSON data using the download tool, found in the developer section of the toolbox. Then, parse the field DownloadData using the JSON parse tool.

We’ll see that, when the data downloads, it does look as readable as we want it to look: we have a “0.” or a “1.” before the JSON_Name data entries. There are several ways to get rid of this. I used the text to columns tool and split the JSON_Name field into two columns on the delimiter ‘.’, and then used Select to remove the first unwanted column, and other columns that we don’t need any more.

To get the data into a tableau ready format, we are going to crosstab our data to get the JSON_Name2 names as headers and JSON_ValueString as our values, grouping on timestamps and our original date time values. The CrossTab configuration should look like this:

Use Latitude and Longitude and the MakePoints spatial tool to create points that we can use to plot a map on Tableau.. And output the file as a spatial file.

We are done we the data prep!

The final workflow should look like this:

Our completed Alteryx workflow
Avatar

Penny Richmond

Thu 29 Apr 2021

Tue 20 Apr 2021