-
-
Save pkkr/924b7cd3dc22e699480d to your computer and use it in GitHub Desktop.
Track the International Space Station (ISS) with Processing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 = "¢er=" + 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