question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Export as WKT1_ESRI or WKT1_GDAL silently returns None for custom CRS

See original GitHub issue

Code Sample, a copy-pastable example if possible

import pyproj

crs_wkt = 'PROJCRS["unknown",BASEGEOGCRS["unknown",DATUM["unknown",ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1,ID["EPSG",9001]]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8901]]],CONVERSION["unknown",METHOD["Equidistant Cylindrical",ID["EPSG",1028]],PARAMETER["Latitude of 1st standard parallel",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8823]],PARAMETER["Longitude of natural origin",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8802]],PARAMETER["False easting",0,LENGTHUNIT["unknown",111319.490793274],ID["EPSG",8806]],PARAMETER["False northing",0,LENGTHUNIT["unknown",111319.490793274],ID["EPSG",8807]]],CS[Cartesian,3],AXIS["(E)",east,ORDER[1],LENGTHUNIT["unknown",111319.490793274]],AXIS["(N)",north,ORDER[2],LENGTHUNIT["unknown",111319.490793274]],AXIS["ellipsoidal height (h)",up,ORDER[3],LENGTHUNIT["metre",1,ID["EPSG",9001]]]]'

crs = pyproj.CRS.from_user_input(crs_wkt)
crs.to_wkt(version="WKT1_ESRI")

Problem description

Export of the custom CRS used above to WKT using version="WKT1_ESRI" returns None. My assumption is that the CRS cannot be expressed as WKT1_ESRI but pyproj does not raise or warn about it but happily returns None instead. The CRS is coming from https://github.com/geopandas/geopandas/issues/2387.

Expected Output

I would expect this to raise or give me some sort of indication that the export did not happen.

Environment Information

pyproj info:
    pyproj: 3.2.1
      PROJ: 8.1.1
  data dir: /Users/martin/mambaforge/envs/geo_dev/share/proj
user_data_dir: /Users/martin/Library/Application Support/proj

System:
    python: 3.9.7 | packaged by conda-forge | (default, Sep 29 2021, 19:24:02)  [Clang 11.1.0 ]
executable: /Users/martin/mambaforge/envs/geo_dev/bin/python
   machine: macOS-12.3-arm64-arm-64bit

Python deps:
   certifi: 2021.10.08
       pip: 21.3.1
setuptools: 58.5.3
    Cython: 0.29.24

Installation method

  • conda-forge

Conda environment information (if you installed with conda):


Environment (conda list):
$ conda list proj
# packages in environment at /Users/martin/mambaforge/envs/geo_dev:
#
# Name                    Version                   Build  Channel
proj                      8.1.1                h2d984c1_2    conda-forge
pyproj                    3.2.1            py39had8e633_2    conda-forge

Details about conda and system ( conda info ):
$ conda info

     active environment : geo_dev
    active env location : /Users/martin/mambaforge/envs/geo_dev
            shell level : 2
       user config file : /Users/martin/.condarc
 populated config files : /Users/martin/mambaforge/.condarc
                          /Users/martin/.condarc
          conda version : 4.10.3
    conda-build version : not installed
         python version : 3.9.7.final.0
       virtual packages : __osx=12.3=0
                          __unix=0=0
                          __archspec=1=arm64
       base environment : /Users/martin/mambaforge  (writable)
      conda av data dir : /Users/martin/mambaforge/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/osx-arm64
                          https://conda.anaconda.org/conda-forge/noarch
          package cache : /Users/martin/mambaforge/pkgs
                          /Users/martin/.conda/pkgs
       envs directories : /Users/martin/mambaforge/envs
                          /Users/martin/.conda/envs
               platform : osx-arm64
             user-agent : conda/4.10.3 requests/2.26.0 CPython/3.9.7 Darwin/21.4.0 OSX/12.3
                UID:GID : 501:20
             netrc file : None
           offline mode : False

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:14 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
martinfleiscommented, Mar 24, 2022

Is this something you are interested in implementing?

I can make a PR for that, yes. Are there any other methods with the same behaviour that should be treated in the same way?

0reactions
martinfleiscommented, Mar 26, 2022

That sounds good. I’ll adapt #1037 accordingly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found