This may an error on my part, but I just installed Suncalc on a Raspberry Pi4b running Bookworm 12.
I wrote the following html page and , while the altitude seems correct, the azimuth seems way off.
Did I miss something obvious?
I used decimal degrees but the result is similar to the altitude.
At 232 degrees azimuth, the result was 0.9077843885362874r.
At 51 degrees altitude, the result was 0.8885089984933949r.
I removed most of the brackets in the code. The editor makes the text invisible.
This is the code:
DOCTYPE html
html
head
title Scallc test /title
script type="text/javascript" src="resources/Suncalc/suncalc.js"/script
div script type="text/javascript"><![CDATA[//><!--
let d = new Date();
latitude=36.3401
longitude=-82.1959
position = SunCalc.getPosition(d, latitude, longitude);
// Access the altitude and azimuth
altitude = position.altitude; // in radians
azimuth = position.azimuth; // in radians
document.body.innerHTML = "h4 align=center" + 'azimuth: '+ azimuth + 'br' + 'altitude: ' + altitude + '/h4'
//--><!]]></script>
/head
body /body>
/html
This may an error on my part, but I just installed Suncalc on a Raspberry Pi4b running Bookworm 12.
I wrote the following html page and , while the altitude seems correct, the azimuth seems way off.
Did I miss something obvious?
I used decimal degrees but the result is similar to the altitude.
At 232 degrees azimuth, the result was 0.9077843885362874r.
At 51 degrees altitude, the result was 0.8885089984933949r.
I removed most of the brackets in the code. The editor makes the text invisible.
This is the code:
DOCTYPE html
html
head
title Scallc test /title
script type="text/javascript" src="resources/Suncalc/suncalc.js"/script
div script type="text/javascript"><![CDATA[//><!--
let d = new Date();
latitude=36.3401
longitude=-82.1959
position = SunCalc.getPosition(d, latitude, longitude);
// Access the altitude and azimuth
altitude = position.altitude; // in radians
azimuth = position.azimuth; // in radians
document.body.innerHTML = "h4 align=center" + 'azimuth: '+ azimuth + 'br' + 'altitude: ' + altitude + '/h4'
//--><!]]></script>
/head
body /body>
/html