Skip to content

Instantly share code, notes, and snippets.

@denkspuren
Created November 3, 2015 14:41
Show Gist options
  • Save denkspuren/2a7e380f2f2a5b3c703e to your computer and use it in GitHub Desktop.
Save denkspuren/2a7e380f2f2a5b3c703e to your computer and use it in GitHub Desktop.
Track the International Space Station (ISS) with Processing
// http://open-notify.org/Open-Notify-API/ISS-Location-Now/
// https://developers.google.com/maps/documentation/static-maps/intro
// https://developers.google.com/maps/documentation/static-maps/
JSONObject json;
double latitude, longitude;
int zoomVal = 3;
PImage img;
void setup() {
size(640,480);
frameRate(1);
}
void draw() {
json = loadJSONObject("http://api.open-notify.org/iss-now.json");
latitude = json.getJSONObject("iss_position").getDouble("latitude");
longitude = json.getJSONObject("iss_position").getDouble("longitude");
String mapurl = "https://maps.googleapis.com/maps/api/staticmap?";
// String apiKey = "???"; // create your own key, see Google link above
String center = "&center=" + Double.toString(latitude) + "," + Double.toString(longitude);
String zoom = "&zoom=" + Integer.toString(zoomVal);
String size = "&size=640x480";
String options = center + zoom + size + apiKey;
img = loadImage(mapurl + options, "png");
image(img, 0, 0);
ellipse(width/2, height/2, 10, 10);
}
@pkkr
Copy link

pkkr commented Nov 11, 2015

thanks, i just tweaked one tiny thing in my fork. Sadly you can't make an pull request for an gist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment