Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spherical tmerc with negative northing gives inverted latitude #138

Closed
proj4-bot opened this issue May 22, 2015 · 3 comments · Fixed by #440
Closed

spherical tmerc with negative northing gives inverted latitude #138

proj4-bot opened this issue May 22, 2015 · 3 comments · Fixed by #440

Comments

@proj4-bot
Copy link

Reported by dstahlke on 20 Jan 2012 20:32 UTC
It would seem the coordinate (0,-1) would give a result close to (lon_0,lat_0). However, the latitude is inverted in the case where northing is negative and the globe is spherical. If I make the globe elliptical, then it works fine.

~/Desktop/proj$ echo 0 -1 | invproj +proj=tmerc +lat_0=32.936 +lon_0=-117.038 +k=0.9996 +x_0=0 +y_0=0 +a=6378137 +b=6378137 +units=m +no_defs
117d2'16.8"W    32d56'9.568"S
~/Desktop/proj$ echo 0 -1 | invproj +proj=tmerc +lat_0=32.936 +lon_0=-117.038 +k=0.9996 +x_0=0 +y_0=0 +a=6378137 +b=6378136 +units=m +no_defs
117d2'16.8"W    32d56'9.568"N

I believe the problem is related to line 126 of PJ_tmerc.c where the test "xy.y < 0" is done. I don't know enough about proj.4 to give a proper fix.

As a workaround, the spherical function can be disabled and the elliptical version used always. On line 139 of PJ_tmerc.c, change "if(P->es)" to "if(1 || P->es)".

Migrated-From: https://trac.osgeo.org/proj/ticket/138

@proj4-bot
Copy link
Author

Comment by dstahlke on 24 Jan 2012 00:31 UTC
The formatting didn't come out properly for the workaround. It should read as follows: on line 139 of PJ_tmerc.c, change if(P->es) to if(1 || P->es).

@proj4-bot
Copy link
Author

Comment by warmerdam on 3 Mar 2012 22:29 UTC
I have confirmed this is not a regression since 4.7 and I'm not too confident of the suggested solution so I'm not going to take action before 4.8 but this is a fairly serious problem.

@proj4-bot
Copy link
Author

Modified by warmerdam on 3 Mar 2012 22:29 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants