Skip to content

Commit c28f22c

Browse files
authored
Add files via upload
1 parent 0b63f7e commit c28f22c

File tree

7 files changed

+76
-0
lines changed

7 files changed

+76
-0
lines changed
Loading
Binary file not shown.
Loading
Loading
Loading

AutomationScripts/ISS Tracker/iss.txt

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
There are currently 10 astronauts on the ISS:
2+
3+
Mark Vande Hei - on board
4+
Oleg Novitskiy - on board
5+
Pyotr Dubrov - on board
6+
Thomas Pesquet - on board
7+
Megan McArthur - on board
8+
Shane Kimbrough - on board
9+
Akihiko Hoshide - on board
10+
Nie Haisheng - on board
11+
Liu Boming - on board
12+
Tang Hongbo - on board
13+
14+
Your current lat / long is: [26.8393, 80.9231]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# json convert the python dictionary above into a json
2+
import json
3+
import turtle
4+
# urllib.request fetch URLs using a variety of different protocols
5+
import urllib.request
6+
import time
7+
# webbrowser provides a high-level interface to allow displaying Web-based documents to users
8+
import webbrowser
9+
# geocoder takes the data and locate these locations in the map
10+
import geocoder
11+
12+
url = "http://api.open-notify.org/astros.json"
13+
response = urllib.request.urlopen(url)
14+
result = json.loads(response.read())
15+
file = open("iss.txt", "w")
16+
file.write("There are currently " +
17+
str(result["number"]) + " astronauts on the ISS: \n\n") # prints number of astronauts
18+
people = result["people"]
19+
for p in people:
20+
file.write(p['name'] + " - on board" + "\n") # prints names of crew
21+
# print long and lat
22+
g = geocoder.ip('me')
23+
file.write("\nYour current lat / long is: " + str(g.latlng))
24+
file.close()
25+
webbrowser.open("iss.txt")
26+
27+
# Setup the world map in turtle module
28+
screen = turtle.Screen()
29+
screen.setup(1280, 720)
30+
screen.setworldcoordinates(-180, -90, 180, 90)
31+
32+
# load the world map image
33+
screen.bgpic("images/map.gif")
34+
screen.register_shape("images\iss.gif")
35+
iss = turtle.Turtle()
36+
iss.shape("images\iss.gif")
37+
iss.setheading(45)
38+
iss.penup()
39+
40+
while True:
41+
# load the current status of the ISS in real-time
42+
url = "http://api.open-notify.org/iss-now.json"
43+
response = urllib.request.urlopen(url)
44+
result = json.loads(response.read())
45+
46+
# Extract the ISS location
47+
location = result["iss_position"]
48+
lat = location['latitude']
49+
lon = location['longitude']
50+
51+
# Ouput lon and lat to the terminal
52+
lat = float(lat)
53+
lon = float(lon)
54+
print("\nLatitude: " + str(lat))
55+
print("\nLongitude: " + str(lon))
56+
57+
# Update the ISS location on the map
58+
iss.goto(lon, lat)
59+
60+
# Refresh each 5 seconds
61+
time.sleep(5)
62+

0 commit comments

Comments
 (0)