OSGeo / PROJ

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

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

Closed shortjonescipher closed 4 weeks ago

shortjonescipher commented 1 month ago

Example of problem

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

Sorry this is in pyproj but when I raised it with them they said 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
*   *

Problem description

The inverse projection should match the forward projection. The (inf, inf) or (, )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

Sorry, PROJ not installed, using it via pyproj.

Installation method

N/A

jjimenezshaw commented 1 month ago

@erykoff added this projection not so long ago. Maybe he/she can explain the details of the zone selection in the inverse transformation. I do not have clear the values for the false easting set for each zone, and how it may collide with the zone selection. In this case the longitude -37.5 deg is clearly in zone 2 (looking at the ascii art graph), but the x value -0.7576285842105634 is filtered as zone 1.

erykoff commented 1 month ago

"Not long ago" in PROJ terms is March 2022. 😂

Thanks for pointing this out. I was cribbing from the igh code which I think only works by coincidence. I am now figuring out the correct offsets.

erykoff commented 1 month ago

This should be fixed with #4159. Thanks for pointing this out!

busstoptaktik commented 1 month ago

"Not long ago" in PROJ terms is March 2022. 😂

@erykoff - compared to PROJ's total lifetime of around 40 years, anything less than 40 months is hardly a split-second 😊

jjimenezshaw commented 1 month ago

Is there an easy way to see this projection in qgis? (With the openstreetmap for instance)