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

Cassini-Soldner easting difference #3432

Closed
eriksorngard opened this issue Nov 4, 2022 · 1 comment
Closed

Cassini-Soldner easting difference #3432

eriksorngard opened this issue Nov 4, 2022 · 1 comment
Labels

Comments

@eriksorngard
Copy link

Hello,

While stress testing our forward Cassini-Soldner projection, implemented from EPSG documentation and not dependend on PROJ, I notice an increasing difference between PROJ's easting output and ours, with increasing longitudal distance.

The only other software I know that allows me to configure an arbitrary Cassini-Soldner independently of PROJ and project arbitrary coordinates is SurvCE, which yields the same results as our software.

I can recreate PROJ's results by adapting line 45 and 46 in cass.cpp to build with our source code:

    xy.x = nu * A * (1. - A2 * T *
        (C1 - (8. - T + 8. * C) * A2 * C2));

Optimizing EPSG's expression for calculating E (which appears to be the same as Snyder's 13-7) to match PROJ's implementation, i notice a different sign after C1:

    xy.x = nu * A * (1. - A2 * T *
        (C1 + (8. - T + 8. * C) * A2 * C2));

Test results

cs2cs -I -f "%.5f" +proj=cass +lat_0=57 +lon_0=18 +x_0=0 +y_0=0 +ellps=GRS80

PROJ PROJ "EPSG" "EPSG" Difference Difference
Latitude Longitude Easting Northing Easting Northing Easting Northing
57 18 0 0 0 0 0 0
57 15 -182257.97503 4003.72144 -182257.94813 4003.72144 0.02690 0
60 18 0 334158.93324 0 334158.93334 0 0.00010

Should the sign in cass.cpp be flipped?

Best regards,
Erik

Environment Information

  • PROJ version (9.1.0)
  • Ubuntu 22.04, running under Windows 11

Installation method

  • Built from source
rouault added a commit to rouault/PROJ that referenced this issue Nov 4, 2022
…iterative generic inversion to make GIGS 5108 roundtripping tests succeed

The error on the sign after "nu * A * (1. - A2 * T * (C1 ...") dates
back to PROJ origins. All other independent implementations (Apache SIS
cf
/~https://github.com/apache/sis/blob/a04bd4b29816c91fc4dfc66135b8de5e962933a0/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/CassiniSoldner.java,
CSMAP cf
/~https://github.com/normanb/CS-Map/blob/1d8f2db7f13194a99dc218d4cd91754c64a2a774/Source/CS_csini.c)
use the same formulas as EPSG guidance note which is consistent with
Snyder's Map projections - A working manual). So align on them, so that
everyone is consistent (and hopefully right).

While doing it, I've modified the inverse method to use the generic
inversion method to improve its accuracy, which make it possible to
enable the 5108.gie tests that were previously failing on the 1000
iterations roundtripping.
rouault added a commit to rouault/PROJ that referenced this issue Nov 4, 2022
…iterative generic inversion to make GIGS 5108 roundtripping tests succeed

The error on the sign after "nu * A * (1. - A2 * T * (C1 ...") dates
back to PROJ origins. All other independent implementations (Apache SIS
cf
/~https://github.com/apache/sis/blob/a04bd4b29816c91fc4dfc66135b8de5e962933a0/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/CassiniSoldner.java,
CSMAP cf
/~https://github.com/normanb/CS-Map/blob/1d8f2db7f13194a99dc218d4cd91754c64a2a774/Source/CS_csini.c)
use the same formulas as EPSG guidance note which is consistent with
Snyder's Map projections - A working manual). So align on them, so that
everyone is consistent (and hopefully right).

While doing it, I've modified the inverse method to use the generic
inversion method to improve its accuracy, which make it possible to
enable the 5108.gie tests that were previously failing on the 1000
iterations roundtripping.
@rouault
Copy link
Member

rouault commented Nov 4, 2022

totally agree with your diagnostic (good spotting!). Fix in #3433

rouault added a commit to rouault/PROJ that referenced this issue Nov 4, 2022
…iterative generic inversion to make GIGS 5108 roundtripping tests succeed

The error on the sign after "nu * A * (1. - A2 * T * (C1 ...") dates
back to PROJ origins. All other independent implementations (Apache SIS
cf
/~https://github.com/apache/sis/blob/a04bd4b29816c91fc4dfc66135b8de5e962933a0/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/CassiniSoldner.java,
CSMAP cf
/~https://github.com/normanb/CS-Map/blob/1d8f2db7f13194a99dc218d4cd91754c64a2a774/Source/CS_csini.c)
use the same formulas as EPSG guidance note which is consistent with
Snyder's Map projections - A working manual). So align on them, so that
everyone is consistent (and hopefully right).

While doing it, I've modified the inverse method to use the generic
inversion method to improve its accuracy, which make it possible to
enable the 5108.gie tests that were previously failing on the 1000
iterations roundtripping.
@rouault rouault closed this as completed in 78d8982 Nov 7, 2022
rouault added a commit that referenced this issue Nov 7, 2022
cass: fix forward computation of easting (fixes #3432), …
github-actions bot pushed a commit that referenced this issue Nov 7, 2022
cass: fix forward computation of easting (fixes #3432), …
rouault added a commit that referenced this issue Nov 8, 2022
[Backport 9.1] cass: fix forward computation of easting (fixes #3432), …
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants