• Robin Bobcat (unregistered)

    Only additional input I can give would be checking how latdiff and longdiff are calculated. If you are dealing with only North America, sure, fine, whatever. But I could see some really horrible edge cases crop up near the equator, prime meridian, or the poles.

    You have a start point of, say, 90° longitude, and 15° North latitude. Your end point is 100° longitude, and 15° South latitude. If you're treating them as absolute values, then you wind up describing a straight line instead of a diagonal. (Without getting into curvature, etc.)

    Falls under the aegis of 'dealing with polar coordinates' I suppose, but I am willing to bet that those edge cases aren't handled if they're not handling the rest of it well.

  • Khudzlin (nodebb)

    Even if they're signed values, you have a problem around the antimeridian (180°). For londiff, you should take the minimum between lon2 - lon1 and 360 - (lon2 - lon1). That's because the longitude difference between 170° West and 175° East is 15°, not 345°. But the formula is so wrong, it doesn't even matter how they calculate the parameters.

  • David Nuttall (google) in reply to ray10k

    Keep in mind the Earth is not actually a sphere. Because it is spinning, it bulges out in the middle a bit. The equator is quite a few kilometres longer than the (approximate) circle going from the North Pole to the South Pole and back again, say coming down the Prime Meridian and going back up 180 degrees longitude.

  • David Nuttall (google) in reply to Robert

    I remember the police officer on Canada's Worst Driver, Cam Wolley, talking about one of the bad drivers they were trying to teach. He said, "Sometimes you can get away with breaking the law of the land, but when you try to break the laws of physics, you pay for it right away."

Leave a comment on “Off in the Distance”

Log In or post as a guest

Replying to comment #:

« Return to Article