mirror of
https://github.com/jlengrand/ShowMeYourBigSatellite.git
synced 2026-03-10 08:41:21 +00:00
@@ -3,6 +3,10 @@
|
||||
{
|
||||
"selected_items":
|
||||
[
|
||||
[
|
||||
"sat",
|
||||
"satlist"
|
||||
],
|
||||
[
|
||||
"center",
|
||||
"centerStart"
|
||||
@@ -534,6 +538,7 @@
|
||||
"file_history":
|
||||
[
|
||||
"/home/jll/Documents/01_perso/14_ShowMeYourBigSatellite/.git/COMMIT_EDITMSG",
|
||||
"/home/jll/Documents/01_perso/14_ShowMeYourBigSatellite/templates/dropdown_test.html",
|
||||
"/home/jll/Documents/01_perso/14_ShowMeYourBigSatellite/main.py",
|
||||
"/home/jll/Documents/01_perso/14_ShowMeYourBigSatellite/.gitignore",
|
||||
"/home/jll/dev/source/main/spacemetric/keystoneapi/build.xml",
|
||||
@@ -659,8 +664,7 @@
|
||||
"/home/jll/dev/source_git/main_zwolle/csd/build.properties",
|
||||
"/home/jll/dev/source_git/main_zwolle/csd/db/build.properties",
|
||||
"/opt/spacemetric/keystone/config/keystone.postgres",
|
||||
"/home/jll/Desktop/WEB-INF/web.xml",
|
||||
"/home/jll/Documents/01_perso/19_jenkinsArduinoNotification/arduino/blink/Blink/Blink.ino"
|
||||
"/home/jll/Desktop/WEB-INF/web.xml"
|
||||
],
|
||||
"find":
|
||||
{
|
||||
@@ -861,7 +865,7 @@
|
||||
"cols":
|
||||
[
|
||||
0.0,
|
||||
0.53850118085,
|
||||
0.472844615194,
|
||||
1.0
|
||||
],
|
||||
"rows":
|
||||
|
||||
23
main.py
23
main.py
@@ -1,4 +1,5 @@
|
||||
from flask import Flask, jsonify
|
||||
from flask import render_template
|
||||
from flask.ext.cors import cross_origin
|
||||
import os
|
||||
|
||||
@@ -6,13 +7,29 @@ import whereismysat, ephem
|
||||
|
||||
app = Flask('ShowMeYourBigSatellite', static_url_path='/static')
|
||||
|
||||
@app.route('/get_coordinates')
|
||||
@app.route('/get_coordinates/<satName>')
|
||||
@cross_origin(headers=['Content-Type']) # allow all origins all methods.
|
||||
def get_coordinates():
|
||||
sat=whereismysat.getPos("TERRA")
|
||||
def get_coordinates(satName):
|
||||
sat=whereismysat.getPos(satName)
|
||||
return jsonify(longitude=sat.sublong.real / ephem.degree,
|
||||
latitude=sat.sublat.real / ephem.degree)
|
||||
|
||||
@app.route('/satellites')
|
||||
@cross_origin(headers=['Content-Type']) # allow all origins all methods.
|
||||
def satellites():
|
||||
names = whereismysat.satlist.keys()
|
||||
print names
|
||||
return jsonify(name=whereismysat.satlist.keys())
|
||||
|
||||
|
||||
@app.route('/')
|
||||
def hello():
|
||||
return render_template('simplemap.html', satellites=whereismysat.satlist.keys())
|
||||
|
||||
#### #########
|
||||
# Used for testing only
|
||||
##############
|
||||
|
||||
@app.route('/css/<path:path>')
|
||||
def static_proxy_css(path):
|
||||
# send_static_file will guess the correct MIME type
|
||||
|
||||
8
mytornado.py
Normal file
8
mytornado.py
Normal file
@@ -0,0 +1,8 @@
|
||||
from tornado.wsgi import WSGIContainer
|
||||
from tornado.httpserver import HTTPServer
|
||||
from tornado.ioloop import IOLoop
|
||||
from main import app
|
||||
|
||||
http_server = HTTPServer(WSGIContainer(app))
|
||||
http_server.listen(5000)
|
||||
IOLoop.instance().start()
|
||||
@@ -4,9 +4,12 @@ Jinja2==2.7.3
|
||||
MarkupSafe==0.23
|
||||
Werkzeug==0.9.6
|
||||
argparse==1.2.1
|
||||
backports.ssl-match-hostname==3.4.0.2
|
||||
certifi==14.05.14
|
||||
ephem==3.7.5.3
|
||||
itsdangerous==0.24
|
||||
numpy==1.8.1
|
||||
six==1.7.3
|
||||
tornado==4.0
|
||||
wsgiref==0.1.2
|
||||
yolk==0.4.3
|
||||
|
||||
27
static/css/simplemap.css
Normal file
27
static/css/simplemap.css
Normal file
@@ -0,0 +1,27 @@
|
||||
html, body{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#map {
|
||||
float:left;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 100%;
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
#menu{
|
||||
margin-left: 90%;
|
||||
height: 100%;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
h1{
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
h2{
|
||||
font-size: 16px;
|
||||
}
|
||||
@@ -33,7 +33,11 @@ var satelliteIcon = L.icon({
|
||||
|
||||
// Gets the latest satellite position from the server
|
||||
function getPosition(){
|
||||
$.getJSON("http://localhost:5000/get_coordinates",function(result){
|
||||
var urlBase = "http://localhost:5000/get_coordinates/"
|
||||
var satellite = $("#satellite").val();
|
||||
var url = urlBase + satellite;
|
||||
console.log(url);
|
||||
$.getJSON(url,function(result){
|
||||
var pos = new L.latLng(result.latitude, result.longitude);
|
||||
satMarker.setLatLng(pos);
|
||||
map.panTo(satMarker.getLatLng());
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Simple Map</title>
|
||||
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
|
||||
<meta charset="utf-8">
|
||||
<style>
|
||||
html, body, #map {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
|
||||
|
||||
<link href='css/leaflet.css' rel='stylesheet' />
|
||||
</head>
|
||||
<body>
|
||||
<div id="map"></div>
|
||||
</body>
|
||||
|
||||
<script src='js/lib/leaflet.js'></script>
|
||||
<script src="js/lib/jquery.min.js"></script>
|
||||
<script src="js/mapsFun.js"></script>
|
||||
</html>
|
||||
|
||||
29
templates/simplemap.html
Normal file
29
templates/simplemap.html
Normal file
@@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Simple Map</title>
|
||||
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
|
||||
<meta charset="utf-8">
|
||||
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
|
||||
|
||||
<link href='css/leaflet.css' rel='stylesheet' />
|
||||
<link href='css/simplemap.css' rel='stylesheet' />
|
||||
</head>
|
||||
<body>
|
||||
<div id="map"></div>
|
||||
<div id="menu">
|
||||
<h1>Menu<h1>
|
||||
<h2>Select your satellite : <h2>
|
||||
<select id="satellite">
|
||||
{% for sat in satellites %}
|
||||
<option value="{{ sat }}">{{ sat }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<script src='js/lib/leaflet.js'></script>
|
||||
<script src="js/lib/jquery.min.js"></script>
|
||||
<script src="js/mapsFun.js"></script>
|
||||
</html>
|
||||
|
||||
@@ -15,7 +15,7 @@ class TleGroup:
|
||||
self.url = url
|
||||
self.name = name
|
||||
self.load()
|
||||
|
||||
|
||||
def load(self):
|
||||
""" Read a TLEs file stream and creates a list of satellites.
|
||||
This function aims to be called every day"""
|
||||
@@ -35,7 +35,6 @@ class TleGroup:
|
||||
s.close()
|
||||
print "%i satellites loaded into list / Total in list: %i"%(count,len(satlist))
|
||||
|
||||
|
||||
def getPos(name):
|
||||
global satlist
|
||||
for key in satlist.keys():
|
||||
|
||||
Reference in New Issue
Block a user