-
Notifications
You must be signed in to change notification settings - Fork 212
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
Upgrade from 1.9.6 to 2.0.1 causes pyproj.exceptions.ProjError: Error creating CRS to CRS #191
Comments
I confirmed this & made a fix in PR #189. |
Still not working with 2.1.0. |
Glad to hear the error is gone! @KAMI911, the default for input/output for geographic projections is degrees. If you would prefer radians, you can use the |
I am generally use meter based projections like:
As you can see I am using projection strings, as described here: https://pyproj4.github.io/pyproj/html/api/proj.html#pyproj-proj It seems only the my program tests fail. I will look into. |
Maybe the default preserve_units=True can cause thus problem?
When I try to force False with:
The preserve_units remains True. |
@KAMI911, that should be okay. The Would you mind providing examples in code of what you are expecting versus what is actually happening? |
Input: gridetrs = "/home/snowal/projects/pyproj/etrs2eov_notowgs.gsb"
gridgeoid = "/home/snowal/projects/pyproj/geoid_eht.gtx"
from pyproj import Proj, transform
proj1 = Proj('+proj=geocent +ellps=WGS84 +datum=WGS84 +units=m +no_defs ', preserve_units=True)
proj2 = Proj(f'+proj=somerc +lat_0=47.14439372222222 +lon_0=19.04857177777778 +k_0=0.99993 +x_0=650000 +y_0=200000 +ellps=GRS67 +nadgrids={gridetrs} +geoidgrids={gridgeoid} +units=m +no_defs ', preserve_units=True) Output: # version 1.9.6 (PROJ version 5.2.0)
>>> transform(proj1, proj2, 4072352.038, 1406781.664, 4687388.295)
(650742.19224405, 251070.04809174273, 123.85061213087161)
# version 2.1.0 (PROJ version 6.0.0)
>>> transform(proj1, proj2, 4072352.038, 1406781.664, 4687388.295)
(650657.5504410468, 251040.20088167512, 167.514173919335) They seem very close, I wonder if it has to do with something that change in PROJ 6.0.0. |
I see you use |
With PROJ 6.0.0: $ cs2cs '+proj=geocent +ellps=WGS84 +datum=WGS84 +units=m +no_defs' '+proj=somerc +lat_0=47.14439372222222 +lon_0=19.04857177777778 +k_0=0.99993 +x_0=650000 +y_0=200000 +ellps=GRS67 +nadgrids=/home/snowal/projects/pyproj/etrs2eov_notowgs.gsb +geoidgrids=/home/snowal/projects/pyproj/geoid_eht.gtx +units=m +no_defs'
4072352.038 1406781.664 4687388.295
650657.55 251040.20 167.51 |
@snowman2: Yeah, you are right, it seems there small differences between the transformed coordinates. These are differences (in one example las file):
|
It may be because the grids aren't picked up by
The WKT output of the same call does include the grids, so this is likely a bug in PROJ. |
Is this fix will be available in may when proj4 will be available with version 6.0.1? |
I assume so, I think it has been merged in, so it should be included in the next release. |
Confirming this has been fixed in PROJ 6.1.0.
|
I mainly using and testing pyproj under Linux /Ubuntu 18.04 64 bit/ and Travis CI environment.
While I upgraded to latest 2.0.1 version from 1.9.6 version I hit into this problem:
https://travis-ci.org/KAMI911/lactransformer/jobs/505569736
ERROR: test_las_transformation_las_to_EOV2009 (main.TestLasTransformation_from_WGS84geo)
Traceback (most recent call last):
File "test_lactransformer.py", line 388, in test_las_transformation_las_to_EOV2009
self.las_data.TransformPointCloud()
File "/home/travis/build/KAMI911/lactransformer/lactransformer/libs/LasPyConverter.py", line 133, in TransformPointCloud
self.__DestinationOpenedFile.x, self.__DestinationOpenedFile.y, self.__DestinationOpenedFile.z = transform(self.__SourceProj, self.__DestinationProj, self.__SourceOpenedFile.x, self.__SourceOpenedFile.y, self.__SourceOpenedFile.z)
File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/pyproj/init.py", line 507, in transform
_proj._transform(p1, p2, inx, iny, inz)
File "pyproj/_proj.pyx", line 302, in pyproj._proj._transform
File "pyproj/_proj.pyx", line 276, in pyproj._proj.TransProj.init
pyproj.exceptions.ProjError: Error creating CRS to CRS.
When I switch back to 1.9.6 the problems are gone:
https://travis-ci.org/KAMI911/lactransformer/jobs/505579144
Some printings that may help:
(pyproj.Proj('+proj=geocent +ellps=WGS84 +datum=WGS84 +units=m +no_defs ', preserve_units=True), pyproj.Proj('+proj=somerc +lat_0=47.14439372222222 +lon_0=19.04857177777778 +k_0=0.99993 +x_0=650000 +y_0=200000 +ellps=GRS67 +nadgrids=/home/travis/build/KAMI911/lactransformer/lactransformer/grid/etrs2eov_notowgs.gsb +geoidgrids=/home/travis/build/KAMI911/lactransformer/lactransformer/grid/geoid_eht.gtx +units=m +no_defs ', preserve_units=True), array([4072352.038, 4072350.845, 4072352.694, ..., 4071665.054,
4071689.017, 4071695.836]), array([1406781.664, 1406783.521, 1406781.519, ..., 1407165.48 ,
1407119.194, 1407133.864]), array([4687388.295, 4687382.027, 4687385.287, ..., 4687839.668,
4687832.19 , 4687823.562]))
(pyproj.Proj('+proj=geocent +ellps=WGS84 +datum=WGS84 +units=m +no_defs ', preserve_units=True), pyproj.Proj('+proj=somerc +lat_0=47.14439372222222 +lon_0=19.04857177777778 +k_0=0.99993 +x_0=650000 +y_0=200000 +ellps=GRS67 +nadgrids=/home/travis/build/KAMI911/lactransformer/lactransformer/grid/etrs2eov_notowgs.gsb +geoidgrids=/home/travis/build/KAMI911/lactransformer/lactransformer/grid/geoid_eht2014.gtx +units=m +no_defs ', preserve_units=True), array([4072352.038, 4072350.845, 4072352.694, ..., 4071665.054,
4071689.017, 4071695.836]), array([1406781.664, 1406783.521, 1406781.519, ..., 1407165.48 ,
1407119.194, 1407133.864]), array([4687388.295, 4687382.027, 4687385.287, ..., 4687839.668,
4687832.19 , 4687823.562]))
My project's source:
https://github.com/KAMI911/lactransformer/tree/master/lactransformer
Converter class, where I hit to error:
https://github.com/KAMI911/lactransformer/blob/master/lactransformer/libs/LasPyConverter.py#L18
Maybe these Proj instance works differently?
self.__SourceProj = Proj(self.__SourceProjectionString)
self.__DestinationProj = Proj(self.__DestinationProjectionString)
and causes this exception:
Traceback (most recent call last):
File "test_lactransformer.py", line 388, in test_las_transformation_las_to_EOV2009
self.las_data.TransformPointCloud()
File "/home/travis/build/KAMI911/lactransformer/lactransformer/libs/LasPyConverter.py", line 133, in TransformPointCloud
self.__DestinationOpenedFile.x, self.__DestinationOpenedFile.y, self.__DestinationOpenedFile.z = transform(self.__SourceProj, self.__DestinationProj, self.__SourceOpenedFile.x, self.__SourceOpenedFile.y, self.__SourceOpenedFile.z)
File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/pyproj/init.py", line 507, in transform
_proj._transform(p1, p2, inx, iny, inz)
File "pyproj/_proj.pyx", line 302, in pyproj._proj._transform
File "pyproj/_proj.pyx", line 276, in pyproj._proj.TransProj.init
pyproj.exceptions.ProjError: Error creating CRS to CRS.
Is this a bug, o
r did I wrong something? From the documentation I can not see if I have to use
Proj
class differently.The text was updated successfully, but these errors were encountered: