Welcome to the NavList Message Boards.


A Community Devoted to the Preservation and Practice of Celestial Navigation and Other Methods of Traditional Wayfinding

Compose Your Message

Add Images & Files
    Re: Umland Henning's Javascripts- something's wrong?
    From: Frank Reed
    Date: 2015 Jan 1, 12:37 -0800


    Good catch. Yes, something is wrong. Umland's code has been skunked by the evolution of javascript. It's an example of a "legacy code" problem --or less generously, it was was built wrong in the first place. He defined a mathematical function in his code named "trunc" which has in recent years become the name of a standard javascript math function, which means that his code is over-ruled by the built-in function which does something entirely different. This can easily be fixed by changing the name of Umland's function to something less obvious like "inRange360" (which also more aptly describes the purpose of this code). I am attaching a copy of this code, modified in this way. You can run it right here on the NavList message boards, or you can download the file and place it on your computer desktop and run it anytime, even when you have no Internet connection. Another way to achieve the same thing (and to confirm the behavior) is to visit that original web page in Internet Explorer, which does not yet employ the most recent standards for javascript (Microsoft's IE tends to be much more conservative since they target business users who often have legacy code like this). Try it: if you visit that page in IE, it will function correctly.

    More generally, Umland's code is a rather old-fashioned way of achieving its purpose. You don't need it. No one should be calculating the positions of the Sun, Moon, and planets from algorithms (as is done in Umland's code). Instead the positions should be found by "look up" in the JPL datasets which have been the standard for over a decade. That's where the "official" Nautical Almanac data comes from. The only residual algorithm should be a simple interpolation of values between dates.

    Frank Reed
    Conanicut Island USA


    Browse Files

    Drop Files


    What is NavList?

    Join NavList

    (please, no nicknames or handles)
    Do you want to receive all group messages by email?
    Yes No

    You can also join by posting. Your first on-topic post automatically makes you a member.

    Posting Code

    Enter the email address associated with your NavList messages. Your posting code will be emailed to you immediately.

    Email Settings

    Posting Code:

    Custom Index

    Start date: (yyyymm dd)
    End date: (yyyymm dd)

    Visit this site
    Visit this site
    Visit this site
    Visit this site
    Visit this site
    Visit this site