You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sis.apache.org by "Emmanuel Giasson (Jira)" <ji...@apache.org> on 2022/02/18 00:20:00 UTC

[jira] [Created] (SIS-537) wrong longitude in reverse Oblique Stereographic transform

Emmanuel Giasson created SIS-537:
------------------------------------

             Summary: wrong longitude in reverse Oblique Stereographic transform 
                 Key: SIS-537
                 URL: https://issues.apache.org/jira/browse/SIS-537
             Project: Spatial Information Systems
          Issue Type: Bug
          Components: Referencing
    Affects Versions: 1.1
            Reporter: Emmanuel Giasson


The Oblique Stereographic transform projects just fine in forward, but the reverse transform offset almost half the longitudes by nearly 180 degrees. 
h2. 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 fix the +/- 180 degrees issue in this case. Actually, it's not exactly 180 degrees since {{i}} might be correct with either atan or atan2, and only {{j}} might be 180 degrees off. 
h2. To reproduce

With the following transformation, project POINT(30 45) then reverse project. Result is POINT(-149.84855267371876 45.000000000000014)

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]]]



--
This message was sent by Atlassian Jira
(v8.20.1#820001)