Journal Le Marteau's Journal: Programming Q: function that can return "day" or "night" depending on lat/long? 4
Does anyone know where I can find some code (preferably, in Perl, Java or Javascript) that can return, for a passed latitude/longitude, whether it is daylight or nighttime?
not sure (Score:2)
this site seems to be able to get you where you want to go - they say it's done with javascript, which means you should be able to look at their code. http://www.csgnetwork.com/sunriseset.html [csgnetwork.com]
Not Javascript (Score:2)
Re: (Score:1)
Thanks, Gents...
stoolpigeon's recommendation works, but it was copyrighted (which I didn't say was an issue, but it is). Translating from C++ was option "B" on a number of fronts.
But I did find a Perl package which works beautifully and is free: Astro-satpass [cpan.org] which can give the position of the sun, moon, planets, and even satellites, based on time, latitude, longitude and elevation.
Re: (Score:1)
Hmmm... link does not work. Anyway, it's findable at cpan.org, search for "Astro-Satpass"
And it gives star positions, too.