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

Converting between WGS84 longlat and geocent produces invalid data #16

Closed
KAMI911 opened this issue Sep 4, 2015 · 3 comments
Closed

Comments

@KAMI911
Copy link

KAMI911 commented Sep 4, 2015

When I converting coordinates from:
+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
to:
+proj=geocent +ellps=WGS84 +datum=WGS84 +units=m +no_defs
projection I got this wit pyproj:

1.4405084639 103.8377068722 15.271
inf, inf, 15.271

1.3678260389 103.8449220306 23.822
inf, inf, 23.822

Checking with cs2cs command:
cs2cs +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs +to +proj=geocent +ellps=WGS84 +datum=WGS84 +units=m +no_defs -r
provides the right data:
1.4405084639 103.8377068722 15.271
-1524999.86 6191095.61 159267.12

1.3678260389 103.8449220306 23.822
-1525828.66 6191103.04 151232.86

Do you have idea what causes this problem? I tried with Pyproj 1.9.4 (master) that I downloaded today (5c18eef).

@luzhskij
Copy link

luzhskij commented May 7, 2018

Hi! In the pj_transform it is necessary to transfer coordinates in radians.

@snowman2
Copy link
Member

Can you verify this issue still exists with pyproj>=2.1.1?

@snowman2
Copy link
Member

I am pretty sure it has to do with the order of your arguments as 103 is out of range for latlon in the y(lat)-direction:

>>> import pyproj
>>> pyproj.__version__
'2.1.2'
>>> from pyproj import Transformer
>>> trans = Transformer.from_proj("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs", "+proj=geocent +ellps=WGS84 +datum=WGS84 +units=m +no_defs")
>>> trans.transform(1.4405084639, 103.8377068722, 15.271)
(inf, inf, inf)
>>> trans.transform(yy=1.4405084639, xx=103.8377068722, zz=15.271)
(-1524999.862888969, 6191095.609069525, 159267.121032734646)
>>> trans.transform(yy=1.3678260389, xx=103.8449220306, zz=23.822)
(-1525828.6577437809, 6191103.040502722, 151232.86472945704)

Feel free to reopen if you have further questions or issues.

Related to #26

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

No branches or pull requests

3 participants