diff --git a/satnogs.py b/satnogs.py index 17a05ab..35e9f01 100644 --- a/satnogs.py +++ b/satnogs.py @@ -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/') diff --git a/templates/map.html b/templates/map.html index e8487c0..12eb36d 100644 --- a/templates/map.html +++ b/templates/map.html @@ -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("Name: "+x[2]+"") + + }); + }); + - 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("Name: "+data[key]["name"]+"
Norad: "+key+"
Eclipsed?: "+data[key]["eclipsed"]); - sats[key] = marker; - }); - }); - - //Ground Stations - // marker = L.marker({{x["lat_lng"]}},{icon: station,zIndexOffset:-1000}).addTo(mymap); - //marker.bindPopup("Name: {{x['name']}}") - - //Sats //marker = L.marker(data[key]["lat_lng"],{icon: sat,zIndexOffset:1000}).addTo(mymap); //marker.bindPopup("Name: "+data[key]["name"]+"
Norad: "+key+"
Eclipsed?: "+data[key]["eclipsed"]); //sats[key] = marker;