sdrweb: improve adsb.hq.c3d2.de

This commit is contained in:
Astro 2021-10-13 23:44:24 +02:00
parent d3155ea261
commit 227a8827ee
3 changed files with 180 additions and 178 deletions

View File

@ -2,6 +2,7 @@
<html> <html>
<head> <head>
<title>ADS-B planespotting at C3D2.de</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css" integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ==" crossorigin=""/> <link rel="stylesheet" href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css" integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ==" crossorigin=""/>
<style type="text/css"> <style type="text/css">
@ -41,8 +42,6 @@
<script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js" integrity="sha512-gZwIG9x3wUXg2hdXF6+rVkLF/0Vi9U8D2Ntg4Ga5I5BZpVkVxlJWbSQtXPSiUTtC0TjtGOmxa1AJPuV0CPthew==" crossorigin=""></script> <script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js" integrity="sha512-gZwIG9x3wUXg2hdXF6+rVkLF/0Vi9U8D2Ntg4Ga5I5BZpVkVxlJWbSQtXPSiUTtC0TjtGOmxa1AJPuV0CPthew==" crossorigin=""></script>
<script type="text/javascript"> <script type="text/javascript">
Map=null; Map=null;
CenterLat=45.0;
CenterLon=9.0;
Planes={}; Planes={};
NumPlanes = 0; NumPlanes = 0;
Selected=null Selected=null
@ -50,11 +49,9 @@
function getIconForPlane(plane) { function getIconForPlane(plane) {
var r = 255, g = 255, b = 0; var r = 255, g = 255, b = 0;
var maxalt = 40000; /* Max altitude in the average case */ var maxalt = 40000; /* Max altitude in the average case */
var invalt = maxalt-plane.altitude;
var selected = (Selected == plane.hex); var selected = (Selected == plane.hex);
if (invalt < 0) invalt = 0; b = 0.25 + (0.75/maxalt*plane.altitude);
b = parseInt(255/maxalt*invalt);
/* As Icon we use the plane emoji, this is a simple solution but /* As Icon we use the plane emoji, this is a simple solution but
is definitely a compromise: we expect the icon to be rotated is definitely a compromise: we expect the icon to be rotated
@ -67,11 +64,11 @@
/* Give a border to the selected plane. */ /* Give a border to the selected plane. */
if (Selected == plane.hex) { if (Selected == plane.hex) {
selhtml = 'border:1px dotted #0000aa; border-radius:10px;'; selhtml = 'border: 5px solid #FFFF00; border-radius: 100%';
} else { } else {
selhtml = ''; selhtml = '';
} }
he = '<div style="transform: rotate(-'+rotation+'deg); '+selhtml+'">✈️</div>'; he = '<div style="transform: scale('+b+') rotate(-'+rotation+'deg)"><img src="airplane.svg" width="64" height="64" style="'+selhtml+'"></div>';
var icon = L.divIcon({html: he, className: 'plane-icon'}); var icon = L.divIcon({html: he, className: 'plane-icon'});
return icon; return icon;
} }
@ -111,8 +108,8 @@
if (p.flight.length) { if (p.flight.length) {
html += '<b>'+p.flight+'</b><br>'; html += '<b>'+p.flight+'</b><br>';
} }
html += 'Altitude: '+p.altitude+' feet<br>'; html += 'Altitude: '+p.altitude+'ft, ' + Math.round(p.altitude * 0.3048) + 'm<br>';
html += 'Speed: '+p.speed+' knots<br>'; html += 'Speed: '+p.speed+'kts, ' + Math.round(p.speed * 1.852) + 'km/h<br>';
html += 'Coordinates: '+p.lat+', '+p.lon+'<br>'; html += 'Coordinates: '+p.lat+', '+p.lon+'<br>';
i.innerHTML = html; i.innerHTML = html;
} }
@ -164,6 +161,10 @@
delete Planes[p]; delete Planes[p];
} }
} }
refreshGeneralInfo();
window.setTimeout(fetchData, 500);
}); });
} }
@ -180,8 +181,7 @@
/* Setup our timer to poll from the server. */ /* Setup our timer to poll from the server. */
window.setInterval(function() { window.setInterval(function() {
fetchData(); fetchData();
refreshGeneralInfo(); }, 500);
}, 100);
} }
</script> </script>

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" viewBox="0 0 300 375" style="enable-background:new 0 0 300 300;" xml:space="preserve"><g><g><path d="M149.997,0C67.158,0,0.003,67.161,0.003,149.997S67.158,300,149.997,300s150-67.163,150-150.003S232.837,0,149.997,0z M222.978,99.461l-32.435,30.711l20.562,82.844l-12.27,12.27l-39.262-64.028l-0.905-0.905l-40.385,38.24 c-0.228,0.231-0.485,0.405-0.718,0.622l-1.297,29.481l-44.965-44.962l29.471-1.294c0.218-0.239,0.394-0.493,0.625-0.724 l38.24-40.387L139.314,141l-64.601-39.832l12.27-12.27l82.471,20.946l31.079-32.827c6.201-6.201,16.251-6.199,22.447,0 C229.177,83.215,229.177,93.263,222.978,99.461z"/></g></g><text x="0" y="315" fill="#000000" font-size="5px" font-weight="bold" font-family="'Helvetica Neue', Helvetica, Arial-Unicode, Arial, Sans-serif">Created by egi enggryawan</text><text x="0" y="320" fill="#000000" font-size="5px" font-weight="bold" font-family="'Helvetica Neue', Helvetica, Arial-Unicode, Arial, Sans-serif">from the Noun Project</text></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -34,6 +34,7 @@
root = pkgs.runCommandNoCC "adsb-map" {} '' root = pkgs.runCommandNoCC "adsb-map" {} ''
mkdir $out mkdir $out
cp ${./adsb.html} $out/index.html cp ${./adsb.html} $out/index.html
cp ${./airplane.svg} $out/airplane.svg
''; '';
extraConfig = '' extraConfig = ''
index index.html; index index.html;