OSGeo / PROJ

PROJ - Cartographic Projections and Coordinate Transformations Library
https://proj.org
Other
1.76k stars 791 forks source link

Issue when using a new CRS : Problem with the synchronization with the latest version of EPSG database #3138

Closed mabkoz closed 2 years ago

mabkoz commented 2 years ago

Hello community!

I am writing a python script to convert coordinates from EPSG:4937 to EPSG:9895. I am facing an error which is that the EPSG:9895 is not a valid CRS " Invalid projection: EPSG:9895 (Internal Proj Error: proj_create: crs not found). " . When I go to https://epsg.org/ , I can find the CRS in the EPSG Dataset : v10.058. Correct if I am wrong but I think that the pyproj does not take into consideration the latest version of the Dataset which is v10.058.

trans_group = TransformerGroup(CRS("EPSG:4937").to_3d(),CRS("EPSG:9895").to_3d())

Could you please tell me how to force pyProj to synchronize with the latest version of EPSG Dataset in order to recognize my CRS ? Thank you in advance!

Expected Output

I expect the code to convert the coordinates from EPSG:4937 to EPSG:9895


## compute transformation
# LUREF2020 Bursa is computing 3D information (input N,E,U / lat, long, h)
print(trans_group.transformers[0].transform(49.54779150, 6.323181283, 217.401))

The result is supposed to be : (68133.95971970388, 91221.13528438336, 169.58002639748156) , but I encounter the error.

Environment Information

pyproj -v : pyproj info: pyproj: 3.3.0 PROJ: 8.0.1 PROJ DATA (recommended version): None PROJ Database: 1.0 EPSG Database: v10.018 [2021-04-02] ESRI Database: ArcMap 10.8.1 [2020-05-24] IGNF Database: 3.1.0 [2019-05-24]

System: python: 3.9.7 (default, Sep 16 2021, 16:59:28) [MSC v.1916 64 bit (AMD64)] executable: C:\Users\pckoz\anaconda3\python.exe machine: Windows-10-10.0.22000-SP0

Python deps: certifi: 2021.10.08 pip: 21.2.4 setuptools: 58.0.4 Cython: 0.29.24

pyproj version 3.3.0 PROJ version 8.0.1 PROJ data directory : C:\Users\pckoz\anaconda3\Library\share\proj Python version : 3.9.7 (default, Sep 16 2021, 16:59:28) [MSC v.1916 64 bit (AMD64)] Operation System Information : Windows-10-10.0.22000-SP0

Installation method

Installed with conda " conda install -c conda-forge proj-data "

rouault commented 2 years ago

Could you please tell me how to force pyProj to synchronize with the latest version of EPSG Dataset in order to recognize my CRS ?

you can't. You'll need to use PROJ 9.0.1 that has the updated database when it is released, or build from master / 9.0 branch in the mean time. and possibly just replace the old proj.db with the updated one. But I can't recall if a proj.db from 9.x can work with PROJ 8.0. You may need to update to a pyproj version that supports PROJ 9.0 first.

snowman2 commented 2 years ago

To use pyproj with a different version of PROJ, this guide should come in handy: https://pyproj4.github.io/pyproj/stable/installation.html#installing-from-source