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

CRS.to_proj4() not supproting proj6? #270

Closed
sscherfke opened this issue Apr 15, 2019 · 5 comments · Fixed by #272
Closed

CRS.to_proj4() not supproting proj6? #270

sscherfke opened this issue Apr 15, 2019 · 5 comments · Fixed by #272
Labels

Comments

@sscherfke
Copy link

It looks like CSR.to_pyproj4() is broken with or not ready for Proj 6?

The following code used to run with pyproj 1.9.6 but breaks with 2.1.3:

>>> from pyproj import Proj
>>> Proj({'a': 6371229.0, 'b': 6371229.0, 'lon_0': -10.0, 'o_lat_p': 30.0, 'o_lon_p': 0.0, 'o_proj': 'longlat', 'proj'
: 'ob_tran'})
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".../lib/python3.7/site-packages/pyproj/proj.py", line 303, in __init__
    cstrencode(self.crs.to_proj4().replace("+type=crs", "").strip())
AttributeError: 'NoneType' object has no attribute 'replace'
@snowman2
Copy link
Member

This is a bug. Thanks for the report!

@snowman2 snowman2 added the bug label Apr 15, 2019
@snowman2
Copy link
Member

I believe the issue is related to the order of the proj and o_proj parameters. Until this is updated, you need to add proj first and o_proj second in your dict. See:

assert crs.to_proj4_dict() == {

@snowman2
Copy link
Member

I checked using projinfo:

projinfo '+proj=ob_tran +a=6371229.0 +b=6371229.0 +lon_0=-10.0 +o_lat_p=30.0 +o_lon_p=0.0 +o_proj=longlat +type=crs'
PROJ.4 string:
Error when exporting to PROJ string: DerivedGeographicCRS cannot be exported to PROJ string

But this works:

$ projinfo '+proj=ob_tran +a=6371229.0 +b=6371229.0 +lon_0=-10.0 +o_lat_p=30.0 +o_lon_p=0.0 +o_proj=longlat'
PROJ string:
+proj=ob_tran +a=6371229.0 +b=6371229.0 +lon_0=-10.0 +o_lat_p=30.0 +o_lon_p=0.0 +o_proj=longlat

@snowman2
Copy link
Member

Fix in #272

@snowman2
Copy link
Member

I am going to close this as the solution is merged into master. Thanks for raising the issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants