Ticket #138 (assigned defect)
spherical tmerc with negative northing gives inverted latitude
| Reported by: | dstahlke | Owned by: | warmerdam |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | Core | Version: | Development (trunk) |
| Keywords: | tmerc | Cc: |
Description
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
Change History
Note: See
TracTickets for help on using
tickets.
