Skip to content

Instantly share code, notes, and snippets.

@pkkr
Forked from denkspuren/ISS.pde
Created November 11, 2015 23:17
Show Gist options
  • Save pkkr/924b7cd3dc22e699480d to your computer and use it in GitHub Desktop.
Save pkkr/924b7cd3dc22e699480d 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 = "&key=???"; // 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);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment