+R_A appears to have no effect in Geod() and CRS()
See original GitHub issueProblem description
The +R_A
option is not being honored in Pyproj, whereas it seems to work fine using the geod
CLI tool.
This problem happens if I use pyproj.Geod()
or pyproj.CRS().get_geod()
.
Code sample
My Python code:
import logging
import os
os.environ['PROJ_DEBUG'] = '3'
logging.basicConfig(level=logging.DEBUG)
import pyproj
# DEBUG:pyproj:PROJ_DEBUG: pj_open_lib(proj.ini): call fopen(/.../lib/python3.10/site-packages/pyproj/proj_dir/share/proj/proj.ini) - succeeded
geod1 = pyproj.Geod('+proj=lonlat +ellps=WGS84')
print(geod1.f)
# 0.0033528106647474805
geod1.fwd(-70, 40, 60, 10_000)
# (-69.89851793919364, 40.04498640681145, -119.93473805953444)
geod2 = pyproj.Geod('+proj=lonlat +ellps=WGS84 +R_A')
print(geod2.f)
# 0.0033528106647474805
geod2.fwd(-70, 40, 60, 10_000)
# (-69.89851793919364, 40.04498640681145, -119.93473805953444)
Equivalent CLI invocation using geod
:
export PROJ_DEBUG=3
geod -f '%0.4f' +proj=lonlat +ellps=WGS84 <<< '-70E 40N 60d 10000m'
# pj_ellipsoid - final: a=6378137.000 f=1/298.257, errno=0
# pj_ellipsoid - final: ellps=WGS84
# 70.0447 40.2273 -119.7864m
geod -f '%0.4f' +proj=lonlat +ellps=WGS84 +R_A <<< '-70E 40N 60d 10000m'
# pj_ellipsoid - final: a=6371007.181 f=1/ 0.000, errno=0
# pj_ellipsoid - final: R_A ellps=WGS84
# 70.0448 40.2282 -119.7855m
Expected Output
I expected the output from geod1
to be different from geod2
, and that geod2.f
should be 0
.
I was also surprised to see that the output from the geod
command line tool was different from the output from pyproj.Geod.fwd
. Presumably the difference can be ascribed to different options when compiling the CLI tool (installed via MacPorts) and the Python package (installed via the wheels on PyPI).
I further expected to see “trace” logging output comparable to what the geod
CLI tool emitted, but I suppose that’s a separate issue.
Environment Information
MacOS 12.4 on ARM64.
Versions
pyproj info:
pyproj: 3.4.0
PROJ: 9.1.0
data dir: /.../lib/python3.10/site-packages/pyproj/proj_dir/share/proj
user_data_dir: /.../.local/share/proj
PROJ DATA (recommended version): 1.11
PROJ Database: 1.2
EPSG Database: v10.074 [2022-08-01]
ESRI Database: ArcGIS Pro 3.0 [2022-07-09]
IGNF Database: 3.1.0 [2019-05-24]
System:
python: 3.10.6 (main, Sep 19 2022, 14:40:49) [Clang 13.1.6 (clang-1316.0.21.2.5)]
executable: /.../bin/python
machine: macOS-12.4-arm64-arm-64bit
Python deps:
certifi: 2022.9.14
Cython: None
setuptools: 65.4.1
pip: 22.2.2
Installation method
Installed using Pip in a Venv:
python -m venv venv
./venv/bin/pip install -U pyproj
Issue Analytics
- State:
- Created a year ago
- Comments:8 (4 by maintainers)
Thanks @snowman2, I’ll see about asking on their mailing list or issue tracker.
Oops sorry, I meant to leave this open as an enhancement request for
R_A
in Geod!