Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.1
-
None
Description
The Oblique Stereographic transform projects just fine in forward, but the reverse transform offset almost half the longitudes by nearly 180 degrees.
Bug location and suggested fix
Problem seems to be in
org/apache/sis/referencing/operation/projection/ObliqueStereographic.java
method inverseTransform(...)
...
final double i = atan(x / (h + y));
final double j = atan(x / (g - y)) - i;
...
final double λ = j + 2*i;
EPSG Guidance notes (for instance, p.71 of https://www.iogp.org/wp-content/uploads/2019/09/373-07-02.pdf) uses atan2 instead of atan, which effectively fixes the +/- 180 degrees issue in this case. Actually, it's not exactly 180 degrees since it is possible for i to be correct with either atan or atan2, and only for j to be 180 degrees off.
To reproduce
With the following transformation, project POINT(30 45) then reverse project. Result is POINT(-149.84855267371876 45.000000000000014) but should be near the original point instead.
Param_MT["Oblique Stereographic",
Parameter["semi_major", 6378137.0, Unit["metre", 1]],
Parameter["semi_minor", 6356752.314245179, Unit["metre", 1]],
Parameter["Latitude of natural origin", 45.0, Unit["degree", 0.017453292519943295]],
Parameter["Longitude of natural origin", -70.0, Unit["degree", 0.017453292519943295]]]