-
Notifications
You must be signed in to change notification settings - Fork 422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add getRiseAndSetAtSolarAngle method #135
base: master
Are you sure you want to change the base?
Add getRiseAndSetAtSolarAngle method #135
Conversation
@mourner, are you accepting PRs at the moment? |
Sorry for not reviewing this in time — I got swamped by other commitments and have fallen behind on this project. :( Closing as the PR is superseded by #137, which is more accurate and complete. |
Ah apologies, I misread the description — reopening. |
The name might be confusing indeed. What do you think about |
c794569
to
bd73c8e
Compare
@mourner, I've made some additions:
|
SunCalc.getRiseAndSetAtSolarAngle = function (date, angle, lat, lng, elevation) { | ||
|
||
elevation = elevation || 0; | ||
angle = angle - astroRefraction(angle) * 100; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any idea why I need to multiply by 100
?
This saved me some time, thank you for sharing your solution @MatthiasKunnen ! |
published a new version which include this as https://github.com/Hypnos3/suncalc3 |
I have a use case where I need to get the time on which the sun will be at multiple angles. Since these altitudes are unknown I can't really name them. Therefore I've added the
getRiseAndSetAtSolarAngle
method.The method can be seen as a shortcut to
addTime
followed bygetTimes
that does not pollute the times array. It saves a method call and does not calculate any other times when it doesn't need to.