Skip to content
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

Substitute the exact formulas for the meridional and normal curvatures. #13

Closed
wants to merge 3 commits into from

Conversation

cffk
Copy link
Contributor

@cffk cffk commented Apr 25, 2018

The FCC formulas have a few drawbacks:

  • They involve "magic constants" (given with a limited number of significant digits) with no indication of where they come from.
  • They are based on the Clarke ellipsoid dating back to 1866 so are inconsistent with most modern GIS systems which use the WGS84 ellipsoid.
  • They are written as truncated trigonometric series. There's absolutely no reason not to use the exact expressions (which are simpler!). (Expanding the exact expressions was traditionally done in order to perform integration leading to a series approximation of the elliptic integral. But that's not an issues here.

Because these latitude and longitude coefficients are now exact, several tests (based on the series approximation) now fail. I've left in place the Clarke 1866 parameters. I recommend that the WGS84 parameters be substituted in the process of updating the tests.

I realize that cheap-ruler is already approximate, so why quibble about the coefficients? Two reasons:

  • The new formulas are accurate in limit of small distance.
  • 50 years from now, no-one will be able to figure out what the old formulas mean.

The FCC formulas have a few drawbacks:

* They involve "magic constants" (given with a limited number of significant digits) with no indication of where they come from.
* They are based on the Clarke ellipsoid dating back to 1866 so are inconsistent with most modern GIS systems which use the WGS84 ellipsoid.
* They are written as truncated trigonometric series.  There's absolutely no reason not to use the exact expressions (which are simpler!).  (Expanding the exact expressions was traditionally done in order to perform integration leading to a series approximation of the elliptic integral.  But that's not an issues here.

Because these latitude and longitude coefficients are now exact, several tests (based on the series approximation) now fail.  I've left in place the Clarke 1866 parameters.  I recommend that the WGS84 parameters be substituted in the process of updating the tests.

I realize that cheap-ruler is already approximate, so why quibble about the coefficients?  Two reasons:

* The new formulas are accurate in limit of small distance.
* 50 years from now, no-one will be able to figure out what the old formulas mean.
@cffk
Copy link
Contributor Author

cffk commented Apr 25, 2018

The coefficients in the FCC formulas are only quoted to the nearest centimeter and one of the coefficients is off by about 3 cm (the coefficient of cos2 should be -0.56608 km and not -0.56605 km). The tests should therefore allow an error of at least 10 cm. Once the tests are updated for the new formulas, the error tolerance in the tests could be tightened, e.g., to 0.1 mm.

Copy link
Member

@mourner mourner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! Let's update the ellipsoid and the tests.

@cffk
Copy link
Contributor Author

cffk commented Apr 26, 2018

I'll update the tests... I notice that assertErr implements a relative error check; but almost always in GIS applications an absolute error check make more sense. For example, it's silly that the tests for the bearing are more rigorous near due north rather than due south. So I propose to switch assertErr to doing an absolute error check. Where a relative check really is needed, this can be accomplished in how assertErr is called.

@mourner
Copy link
Member

mourner commented Apr 26, 2018

Yeah, agreed about the error checking.

Ellipsoid.  Still to do: switch to WGS84 + rationalize the error
criteria.
@cffk
Copy link
Contributor Author

cffk commented May 12, 2018

I recommend deferring the update to the ellipsoid and the redoing of the tests to a separate pull request. As it stands, the formulas are in a saner form and the existing tests are all working. It would be good to know how the existing "good" results for tests were created so that I know how to update them for WGS84.

@vng
Copy link
Contributor

vng commented Apr 17, 2020

Here is the updated version: #17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants