def iss_now(): """The International Space Station (ISS) is moving at close to 28,000 km/h so its location changes really fast! Where is it right now? This is a simple api to return the current location above the Earth of the ISS. It returns the current latitude and longitude of the space station with a unix timestamp for the time the location was valid. This API takes no inputs. :status 200: when successful :>json str message: Operation status. :>json int timestamp: Unix timestamp for this location. :>json obj iss_position: Position on Earth directly below the ISS. :>json int iss_position.latitude: Latitude :>json int iss_position.longitude: Longitude **Example response**: .. sourcecode:: http HTTP/1.1 200 OK Content-Type: application/json { "iss_position": { "latitude": -19.783929798887073, "longitude": -72.29753187401747 }, "message": "success", "timestamp": 1454357342 } """ loc = iss.get_location() return dict({'message': "success"}, **loc), 200
def iss_geojson(): """The International Space Station (ISS) is moving at close to 28,000 km/h so its location changes really fast! Where is it going right now? This is a simple api to return the position of the last and next 45 minutes location above the Earth of the ISS in GeoJSON format. This API takes no inputs. :status 200: when successful :>json str message: Operation status. :>json int timestamp: Unix timestamp for this location. :>json list path: previous 45 min position on Earth directly below the ISS. **Example response**: .. sourcecode:: http HTTP/1.1 200 OK Content-Type: application/json { "type": "FeatureCollection", "features: [ { "type": "Feature", "properties": { "timestamp": 1539288424 }, "geometry": { "type": "Point", "coordinates": [ 49.1592790982642, -35.13438039242428 ] } }, { "type": "Feature", "properties": { "timestamp": 1539288424 }, "geometry": { "type": "LineString", "coordinates": [ [ 49.1592790982642, -35.13438039242428 ], [...], ... ] } } ] } """ loc = iss.get_location() path = iss.get_path() geojson = {"type": "FeatureCollection", "features": []} # Add position geojson['features'].append({ "type": "Feature", "properties": { "timestamp": loc['timestamp'] }, "geometry": { "type": "Point", "coordinates": [loc['iss_position']['longitude'],loc['iss_position']['latitude']] } }) # Add path path_geom=[] for pos in path['path']: path_geom.append([pos['iss_position']['longitude'], pos['iss_position']['latitude']]) geojson['features'].append({ "type": "Feature", "properties": { "timestamp": loc['timestamp'] }, "geometry": { "type": "LineString", "coordinates": path_geom } }) return dict(geojson), 200
def iss_now(): loc = iss.get_location() return dict({'message': "success"}, **loc), 200
from iss import get_location from gmaps import get_location_by_long_lat,get_city,no_location iss = get_location() latitude = iss['lat'] longitude = iss['long'] location = get_location_by_long_lat(longitude,latitude) if(no_location(location) == True): print "Currently located above an ocean" else: print get_city(location)
from time import sleep import machine, ssd1306 import iss i2c = machine.I2C(scl=machine.Pin(5), sda=machine.Pin(4)) oled = ssd1306.SSD1306_I2C(128, 32, i2c, 0x3c) interval = 10 while True: iss.overhead(oled, interval) sleep(interval) iss.get_location(oled) sleep(interval)