1
0
Fork 0

Inital map objects

merge-requests/1/head
wgaylord 2018-12-18 21:09:46 -06:00
parent ec8d2eeca0
commit 94762a8e1a
2 changed files with 10 additions and 32 deletions

View File

@ -139,7 +139,7 @@ def map_view():
def api_active_stations():
sations = []
for x in Stations:
sations.append([x["name"],x["lat"],x["lng"]])
sations.append([x["name"],[x["lat"],x["lng"]]])
return json.dumps(sations)
@app.route('/stations_from_sat/<string:norad>')

View File

@ -73,6 +73,8 @@ var active_station = L.icon({
}).addTo(mymap);
Stations = []
function UpdateMap(e) {
var satPos = e[0]
var links = e[1]
@ -80,38 +82,14 @@ function UpdateMap(e) {
$.get("/activestations", function(data, status){
data = JSON.parse(data)
Object.keys(data).forEach(function(key){
sat = light_sat
if(data[key]["eclipsed"]){
sat = dark_sat
}
if(data[key]["image"] != null){
image = data[key]["image"]
if(data[key]["eclipsed"]){
image = image + "-dark.png"
}else{
image = image + "-light.png"
}
Object.keys(data).forEach(function(x){
marker = L.marker([1],{icon: station,zIndexOffset:-1000}).addTo(mymap);
marker.bindPopup("<b>Name: "+x[2]+"</b>")
});
});
sat = L.icon({
iconUrl: image,
iconSize: [40, 40],
iconAnchor: [20, 20],
popupAnchor: [0, 0],
});
}
marker = L.marker(data[key]["lat_lng"],{icon: sat,zIndexOffset:1000}).addTo(mymap);
marker.bindPopup("<b>Name: "+data[key]["name"]+"</b><br><b>Norad: "+key+"</b><br><b>Eclipsed?: "+data[key]["eclipsed"]);
sats[key] = marker;
});
});
//Ground Stations
// marker = L.marker({{x["lat_lng"]}},{icon: station,zIndexOffset:-1000}).addTo(mymap);
//marker.bindPopup("<b>Name: {{x['name']}}</b>")
//Sats
//marker = L.marker(data[key]["lat_lng"],{icon: sat,zIndexOffset:1000}).addTo(mymap);
//marker.bindPopup("<b>Name: "+data[key]["name"]+"</b><br><b>Norad: "+key+"</b><br><b>Eclipsed?: "+data[key]["eclipsed"]);
//sats[key] = marker;