Track live position of International Space Station and people in space — using Python

http://open-notify.org/Open-Notify-API/ISS-Location-Now/
http://api.open-notify.org/iss-now.json

## Content of the above JSON file :

{"iss_position": {"longitude": "-41.8150", "latitude": "30.4643"}, "message": "success", "timestamp": 1613412345}
http://api.open-notify.org/astros.json
  1. First we are going to read the ISS location JSON file:
ISSurl = 'http://api.open-notify.org/iss-now.json'

ISS_Loc_DF = pd.read_json(ISSurl)
print("Basic info of ISS : ")
print(ISS_Loc_DF)
Basic info of ISS : 
iss_position message timestamp
latitude -2.5352 success 2021-02-15 18:16:59
longitude -14.8967 success 2021-02-15 18:16:59
# get the live latitude and longitude of ISS
ISS_Loc_DF['latitude'] = ISS_Loc_DF.loc['latitude', 'iss_position']
ISS_Loc_DF['longitude'] = ISS_Loc_DF.loc['longitude', 'iss_position']
ISS_Loc_DF.reset_index(inplace=True)

# drop unwanted columns
ISS_Loc_DF = ISS_Loc_DF.drop(['index','message'], axis=1)
print("Final position dataframe to refer : ")
print(ISS_Loc_DF)
Final position dataframe to refer : 
iss_position timestamp latitude longitude
0 -2.5352 2021-02-15 18:16:59 -2.5352 -14.8967
1 -14.8967 2021-02-15 18:16:59 -2.5352 -14.8967
# Show the position of the ISS in global map
iss_position = pe.scatter_geo(ISS_Loc_DF, lat='latitude', lon='longitude')
iss_position.show()
## Find the Number of people in space right now:
peopleurl = 'http://api.open-notify.org/astros.json'
People_DF = pd.read_json(peopleurl)
print(People_DF)
message  number                                            people
0 success 7 {'craft': 'ISS', 'name': 'Sergey Ryzhikov'}
1 success 7 {'craft': 'ISS', 'name': 'Kate Rubins'}
2 success 7 {'craft': 'ISS', 'name': 'Sergey Kud-Sverchkov'}
3 success 7 {'craft': 'ISS', 'name': 'Mike Hopkins'}
4 success 7 {'craft': 'ISS', 'name': 'Victor Glover'}
5 success 7 {'craft': 'ISS', 'name': 'Shannon Walker'}
6 success 7 {'craft': 'ISS', 'name': 'Soichi Noguchi'}
print("People who are available in space now : ")
for index, row in People_DF.iterrows():
name = People_DF['people'].values[index]['name']
print(name)
People who are available in space now : 
Sergey Ryzhikov
Kate Rubins
Sergey Kud-Sverchkov
Mike Hopkins
Victor Glover
Shannon Walker
Soichi Noguchi
print("Let's check who are they : ")
for index, row in People_DF.iterrows():
name = People_DF['people'].values[index]['name']
print(name)
query = name+' iss'
for i in search(query, tld="co.in", num=4, stop=4, pause=2):
print(i)
Let's check who are they : 
Sergey Ryzhikov
https://en.wikipedia.org/wiki/Sergey_Ryzhikov_(cosmonaut)
https://en.wikipedia.org/wiki/Sergey_Ryzhikov_(cosmonaut)#Cosmonaut_career
https://en.wikipedia.org/wiki/Sergey_Ryzhikov_(cosmonaut)#Expedition_49/50
https://www.nasa.gov/image-feature/expedition-64-commander-sergey-ryzhikov-of-roscosmos
Kate Rubins
http://t0.gstatic.com/images?q=tbn:ANd9GcTFLk1C2z0Tr-8CF9HPl3S2AKG1GjMPdC8rSFBxvTQGpLYMdtPurLXdEmTPkape
https://en.wikipedia.org/wiki/Kathleen_Rubins
https://en.wikipedia.org/wiki/Jeffrey_Williams_(astronaut)
https://en.wikipedia.org/wiki/Soyuz_MS-01
Sergey Kud-Sverchkov
https://en.wikipedia.org/wiki/Sergey_Kud-Sverchkov
http://t0.gstatic.com/images?q=tbn:ANd9GcQzRyC8GCNyvfiFy8jlWO-ifVywdEgvMJT2yICzYaK6PED2oZ2OcPyNpv-ZfX_d
https://www.nasa.gov/image-feature/cosmonauts-sergey-ryzhikov-and-sergey-kud-sverchkov

Complete code:

import pandas as pd
import plotly.express as pe
from googlesearch import search

# refer http://open-notify.org/Open-Notify-API/ISS-Location-Now/ link for more details:
ISSurl = 'http://api.open-notify.org/iss-now.json'

ISS_Loc_DF = pd.read_json(ISSurl)
print("Basic info of ISS : ")
print(ISS_Loc_DF)

# get the live latitude and longitude of ISS
ISS_Loc_DF['latitude'] = ISS_Loc_DF.loc['latitude', 'iss_position']
ISS_Loc_DF['longitude'] = ISS_Loc_DF.loc['longitude', 'iss_position']
ISS_Loc_DF.reset_index(inplace=True)
# drop unwanted columns
ISS_Loc_DF = ISS_Loc_DF.drop(['index','message'], axis=1)
print("Final position dataframe to refer : ")
print(ISS_Loc_DF)

# Show the position of the ISS in global map
iss_position = pe.scatter_geo(ISS_Loc_DF, lat='latitude', lon='longitude')
iss_position.show()

## Find the Number of people in space right now:
peopleurl = 'http://api.open-notify.org/astros.json'
People_DF = pd.read_json(peopleurl)
print(People_DF)


print("People who are available in space now : ")
for index, row in People_DF.iterrows():
name = People_DF['people'].values[index]['name']
print(name)

print("Let's check who are they : ")
for index, row in People_DF.iterrows():
name = People_DF['people'].values[index]['name']
print(name)
query = name+' iss'
for i in search(query, tld="co.in", num=4, stop=4, pause=2):
print(i)

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store