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

Assorted fixes related to +geoc flag handing #1093

Merged
merged 3 commits into from Aug 24, 2018

Conversation

Projects
None yet
2 participants
@rouault
Member

rouault commented Aug 19, 2018

While digging geocentric latitude support in PROJ, I discovered there was an existing (and somewhat unknown) +geoc flag whose semantic is: the input latitude is a geocentric one.

  • The first commit fixes a regression of PROJ 5 in the inverse code path where the geodetic -> geocentric conversion was missing
  • The second commit is somewhat independant of the first one, but was found when investigating the issue: it appears there is dead code in the fwd_finalize() and inv_prepare(), so remove it since looking at it, I believe it wouldn't behave correctly if hit
  • The third commit is independent of the two above ones, and for consistency, make +geoc honoured in the legacy pj_transform() / cs2cs case (was easier for me to implement that, so as to check the correctness of the fix in the first commit)

rouault added some commits Aug 19, 2018

pj_inv(): fix inverse of +proj=longlat +geoc
There is a regression in PROJ 5 regarding the handling of the +geoc flag,
specific to the case of +proj=longlat, and the inverse transformation,
which makes it a no-op:

echo "12   55 0 "  | src/cct  +proj=pipeline +step +proj=longlat +ellps=GRS80   +geoc +inv
 12.0000000000   55.0000000000        0.0000           inf

With this fix, we now get:

echo "12   55 0 "  | src/cct  +proj=pipeline +step +proj=longlat +ellps=GRS80   +geoc +inv
 12.0000000000   54.8189733083        0.0000           inf

The fix consists in making inv_prepare() do symetrically as fwd_finalize(), ie
skip a number of transforms when left and right units are angular,
and in inv_finalize() apply the (OUTPUT_UNITS==PJ_IO_UNITS_ANGULAR) processing
even if INPUT_UNITS == PJ_IO_UNITS_ANGULAR
Remove dead code in fwd_finalize() and inv_prepare()
Those functions contain code specific of input != angular and output = angular
which to the best of my knowledge never happens in PROJ. Looking at that
code, I feel there are a number of errors in it, and anyway removing it shows
absolutely no change in the test suite, which shows it is unused. I've also
added exit(1) to verify that those code paths are never taken.

This was found while investigating the fix for
8cfc813
@kbevers

This comment has been minimized.

Member

kbevers commented Aug 19, 2018

As far as I can tell this looks all right but I am not too familiar with the geocentric code so let's hear what @busstoptaktik thinks?

@kbevers kbevers added this to the 5.2.0 milestone Aug 24, 2018

@kbevers kbevers merged commit 502bc55 into OSGeo:master Aug 24, 2018

3 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.1%) to 77.914%
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment