Anyone know of a web service or .NET class library that can provide rise/set ti开发者_StackOverflow社区mes for the sun and moon for any given date and any given latitude/longitude?
Thanks in advance.
yes - the SunTime class at CodeProject may be of some help!
Have a look at The ASCOM Initiative. This is the technology used by Microsoft's World Wide Telescope to provide control of telescopes. In version 5.5 of the ASCOM Platform, one of the new components that we've just introduced is a .NET interface to the NOVAS library, which gives you a host of vector astrometry routines and the Kepler orbit engine for doing positional astrometry on solar system bodies.
I don't think that there is a function that will directly give you sunrise/sunset, but it will give you all of the building blocks you need to compute these and much more.
All of this is open source, too. The original NOVAS routines are available from the US Naval Observatory site linked above, in both FORTRAN and C. The ASCOM source code is available from our subversion server.
Also, there is a ephemeris which might be what you're looking for as this is the ultimate astronomer programming kit? Have made a feeble attempt at it a few years ago when I made an astrology program using VB6, it produced a nice report of the starsigns in the each of the twelve houses, but couldn't get the drawing of the stars at the time of the birthdate/time input accurate enough.
Hope this helps, Best regards, Tom.
CoordinateSharp is perfect for this and super easy to use.
using CoordinateSharp;
//Seattle on 5-Jun-2018 @ 10:10
Coordinate c = new Coordinate(47.6062, -122.3321, new DateTime(2018,6,5,10,10,0));
Console.WriteLine(c.CelestialInfo.SunSet); // 5-Jun-2018 4:02:00 AM
It can do both solar and lunar times to include eclipses.
精彩评论