Subscribe Bookmark



Mar 21, 2013

JSON SpaceStation VisibleEarth

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 .


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.

1 Comment

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"}
Article Tags