cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Discovery is online this week, April 16 and 18. Join us for these exciting interactive sessions.
Choose Language Hide Translation Bar
Craige_Hales
Super User
JSON SpaceStation VisibleEarth

update 10apr2018: see Bryan's script for a modern approach. I also made a video.

 

This JMP graph is built from a background image downloaded from NASA, an overlay of country outlines built into JMP, and a track of the International Space Station (which updates every 30 seconds if you run the attached script).  Credits to NASA Visible Earth: Earth's City Lights and Open Notify -- API Doc | ISS Current Location .

 

11511_ISSTrack.PNG

 

Also credit to Xan for the JSON parsing code; the Open Notify site delivers a JSON file that looks like this:

{

  "iss_position": {

  "latitude": 24.94415308475734,

  "longitude": 116.70173230986174

  },

  "message": "success",

  "timestamp": 1462990726

}

 

and is parsed with this JSL: locationData = JSON:parse( where ) after fetching the JSON above into where.  Getting the values from the locationData then looks like lat[idx] = locationData["iss_position"]["latitude"]; where the lat variable (and a lon variable too) will later plot the points in the graph.  A trimmed-down version of the JSON parser is in the first 70 lines of the file, followed by the code for this post.

 

The JSL contains a number of commands to adjust the axes and frame to make the country outlines and bitmap line up better...turning off the projection and positioning the bitmap.  There is also a JSL Scheduler to update the display every 30 seconds.

Last Modified: Apr 10, 2018 10:01 AM
Comments
Craige_Hales
Super User

update:  Apparently the JSON data from the site has changed; the numbers are now quoted strings.  Change the JSL to add the num(...) function:

		lat[idx] = num(locationData["iss_position"]["latitude"]); // get the two numbers
		lon[idx] = num(locationData["iss_position"]["longitude"]); // used in the script below to plot a point

because this is now a string

{
"message": "success", "timestamp": 1484682500,
"iss_position": {"latitude": "-8.1751", "longitude": "6.8537"}
}