Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Unexpected Oblique Mercator (omerc) inverse proj result when alpha is between 90 and 270 #331
PROJ.4 version : v4.9.2, 08 September 2015
I was working on a module to allow a user to specify a local grid using the 'omerc', basically following what was suggested here:
This appears to work fine when the alpha angle is 270 to 360 and 0 to 90. If I specify an alpha greater than 90 but less than 270, I get strange results, see my test case below:
I would expect that proj should be able to handle this because reversing the angle from 91 to 271 does return the correct answer.
Is this a bug or is it expected behavior? is there a way to adjust the parameters to get the behavior I'm looking for?
I compared the implementation with the reference at http://www.ihsenergy.com/epsg/guid7.pdf, on page 34, there is
In PJ_omerc.c, the code is using atan2 which is giving different results when alpha is greater than 90 degrees, I tried replacing the atan2 with the atan from the reference and I now get correct results in my test case (I've not tested anything else)
I'm not sure why atan2 is being used here, I think it could be an issue, but changing it might break something else relying on this behavior.
Sorry that I haven't looked at this for a bit, I did look through the archives and found a message that is essentially the same issue that I ran into:
I have a workaround for the moment, I subtract 180 degrees from the alpha and inverse the sign on easting/northing.