Skip to content

Commit d424949

Browse files
committed
Dist v1.0.1
1 parent 459cd12 commit d424949

File tree

8 files changed

+103
-0
lines changed

8 files changed

+103
-0
lines changed

build/lib/iss_tracker/__init__.py

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#!/usr/bin/python
2+
3+
import requests
4+
import json
5+
import threading
6+
import datetime
7+
import tkinter
8+
import urllib.request
9+
from PIL import ImageTk, Image
10+
import math
11+
12+
prev_lat, prev_long, prev_time, prev_speed = 0, 0, 0, 0
13+
14+
def distance_on_unit_sphere(lat1, long1, lat2, long2):
15+
16+
# Convert latitude and longitude to
17+
# spherical coordinates in radians.
18+
degrees_to_radians = math.pi/180.0
19+
20+
# phi = 90 - latitude
21+
phi1 = (90.0 - lat1)*degrees_to_radians
22+
phi2 = (90.0 - lat2)*degrees_to_radians
23+
24+
# theta = longitude
25+
theta1 = long1*degrees_to_radians
26+
theta2 = long2*degrees_to_radians
27+
28+
# Compute spherical distance from spherical coordinates.
29+
30+
# For two locations in spherical coordinates
31+
# (1, theta, phi) and (1, theta', phi')
32+
# cosine( arc length ) =
33+
# sin phi sin phi' cos(theta-theta') + cos phi cos phi'
34+
# distance = rho * arc length
35+
36+
cos = (math.sin(phi1)*math.sin(phi2)*math.cos(theta1 - theta2) +
37+
math.cos(phi1)*math.cos(phi2))
38+
arc = math.acos( cos )
39+
40+
# Remember to multiply arc by the radius of the earth
41+
# in your favorite set of units to get length.
42+
return arc
43+
44+
45+
def start():
46+
top = tkinter.Tk()
47+
top.title("ISS Tracker")
48+
49+
def counter_label(label):
50+
51+
def count():
52+
global prev_lat
53+
global prev_long
54+
global prev_time
55+
global prev_speed
56+
req = requests.get("http://api.open-notify.org/iss-now.json")
57+
58+
obj = req.json()
59+
lat = float(obj['iss_position']['latitude'])
60+
long = float(obj['iss_position']['longitude'])
61+
timestamp = int(obj['timestamp'])
62+
time_change = timestamp - prev_time
63+
distance_moved = distance_on_unit_sphere(prev_lat, prev_long,
64+
lat, long) * 4164
65+
speed = distance_moved * 3600
66+
67+
if time_change != 1 or distance_moved > 5:
68+
label.config(text="Estimated speed: {} mph\nLatitude: {}\nLongitude: {}".format(prev_speed, lat, long))
69+
else:
70+
label.config(text="Estimated speed: {} mph\nLatitude: {}\nLongitude: {}".format(speed, lat, long))
71+
prev_speed = speed
72+
prev_lat, prev_long, prev_time = lat, long, timestamp
73+
label.after(1000, count)
74+
count()
75+
title = tkinter.Label(top, height=1, width=50,
76+
font=("Arial", 25, "bold"), text="ISS Tracker")
77+
title.pack()
78+
label = tkinter.Label(top, height=3, width=50, font=("Arial", 20))
79+
label.pack()
80+
counter_label(label)
81+
top.mainloop()
2.27 KB
Binary file not shown.

dist/iss_tracker-1.0.1.tar.gz

1.91 KB
Binary file not shown.

iss_tracker.egg-info/PKG-INFO

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Metadata-Version: 2.1
2+
Name: iss-tracker
3+
Version: 1.0.1
4+
Summary: A simple Tkinter GUI for tracking the International Space Station
5+
Home-page: http://github.com/bsoyka/iss-tracker
6+
Author: Benjamin Soyka
7+
Author-email: bensoyka@icloud.com
8+
License: GPL-3.0
9+
Description: # ISS Tracker
10+
Platform: UNKNOWN
11+
Description-Content-Type: text/markdown

iss_tracker.egg-info/SOURCES.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
README.md
2+
setup.py
3+
iss_tracker/__init__.py
4+
iss_tracker.egg-info/PKG-INFO
5+
iss_tracker.egg-info/SOURCES.txt
6+
iss_tracker.egg-info/dependency_links.txt
7+
iss_tracker.egg-info/not-zip-safe
8+
iss_tracker.egg-info/top_level.txt
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

iss_tracker.egg-info/not-zip-safe

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

iss_tracker.egg-info/top_level.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
iss_tracker

0 commit comments

Comments
 (0)