pyproj4 / pyproj

Python interface to PROJ (cartographic projections and coordinate transformations library)
https://pyproj4.github.io/pyproj
MIT License
1.04k stars 210 forks source link

Interrupted Mollweide gives wrong result on inverse projections of some lat/lons. #1402

Closed shortjonescipher closed 3 months ago

shortjonescipher commented 3 months ago
>>> p = Proj('+proj=imoll +R=1')
>>> p(-37.5, 7.5)
(-0.7576285842105634, 0.1452338366477549)
>>> p(-0.7576285842105634, 0.1452338366477549, inverse=True)
(inf, inf)

Problem description

The inverse projection should match the forward projection. The (inf, inf) result causes some parts of a world image based on the inverse projection to be missing. This lat/lon is just an example, several others are also affected.

Expected Output

(-37.5, 7.5)

Environment Information

pyproj info: pyproj: 3.5.0 PROJ: 9.2.0 data dir: C:\Users\Christopher\AppData\Local\Programs\Python\Python38\lib\site-packages\pyproj\proj_dir\share\proj user_data_dir: C:\Users\Christopher\AppData\Local/proj PROJ DATA (recommended version): 1.13 PROJ Database: 1.2 EPSG Database: v10.082 [2023-02-06] ESRI Database: ArcGIS Pro 3.1 [2023-19-01] IGNF Database: 3.1.0 [2019-05-24]

System: python: 3.8.7 (tags/v3.8.7:6503f05, Dec 21 2020, 17:59:51) [MSC v.1928 64 bit (AMD64)] executable: C:\Users\Christopher\AppData\Local\Programs\Python\Python38\python.exe machine: Windows-10-10.0.19041-SP0

Python deps: certifi: 2022.12.7 Cython: None setuptools: 49.2.1 pip: 20.2.3

Installation method

pip install pyproj

Conda environment information (if you installed with conda):

snowman2 commented 3 months ago

The behavior is consistent with PROJ:

echo -37.5 7.5 | proj +proj=imoll +R=1
-0.76   0.15
echo -0.7576285842105634 0.1452338366477549 | proj -Iv +proj=imoll +R=1
*   *

The core logic for this operation is handled by PROJ. Please raise an issue here: https://github.com/OSGeo/PROJ/