Skip to content

Commit

Permalink
Merge pull request #1026 from kbevers/fix-geocent
Browse files Browse the repository at this point in the history
Do not pivot over WGS84 when doing cs2cs-emulation with geocent
  • Loading branch information
kbevers authored Jun 1, 2018
2 parents fea2d9b + c480b1a commit de44aa7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/proj_4D_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -524,11 +524,13 @@ Returns 1 on success, 0 on failure
return 0;
P->cart = skip_prep_fin (Q);

sprintf (def, "break_cs2cs_recursion proj=cart ellps=WGS84");
Q = proj_create (P->ctx, def);
if (0==Q)
return 0;
P->cart_wgs84 = skip_prep_fin (Q);
if (!P->is_geocent) {
sprintf (def, "break_cs2cs_recursion proj=cart ellps=WGS84");
Q = proj_create (P->ctx, def);
if (0==Q)
return 0;
P->cart_wgs84 = skip_prep_fin (Q);
}
}

return 1;
Expand Down
18 changes: 18 additions & 0 deletions test/gie/4D-API_cs2cs-style.gie
Original file line number Diff line number Diff line change
Expand Up @@ -291,4 +291,22 @@ accept 4.05 52.1 0
expect 4.05 52.1 -10
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
Test bug fix of /~https://github.com/OSGeo/proj.4/issues/1025.
Using geocent in the new API with a custom ellipsoid should return coordinates
that correspond to that particular ellipsoid and not WGS84 as demonstrated in
the bug report.
-------------------------------------------------------------------------------
operation +proj=pipeline +step
+proj=longlat +a=3396190 +b=3376200 +inv +step
+proj=geocent +a=3396190 +b=3376200 +lon_0=0 +units=m
accept 0.0 0.0 0.0
expect 3396190.0 0.0 0.0
roundtrip 1

operation +proj=geocent +a=3396190 +b=3376200 +lon_0=0 +units=m
accept 0.0 0.0 0.00
expect 3396190.0 0.0 0.0
roundtrip 1

</gie>

0 comments on commit de44aa7

Please sign in to comment.