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

Unexpected CRS inequality #3725

Closed
djhoese opened this issue May 11, 2023 · 1 comment · Fixed by #3727
Closed

Unexpected CRS inequality #3725

djhoese opened this issue May 11, 2023 · 1 comment · Fixed by #3727
Assignees
Labels

Comments

@djhoese
Copy link
Contributor

djhoese commented May 11, 2023

Example of problem

#include <proj.h>
#include <stdio.h>

int main(void) {
    PJ_CONTEXT* context = proj_context_create();
    PJ* pj1 = proj_create(
        context,
        "+proj=geos +lon_0=0 +h=35786400 +a=6378137.0 +rf=298.257223563 +units=m +sweep=y +no_defs +type=crs"
    );
    PJ* pj2 = proj_create(
        context,
        "+proj=geos +lon_0=0 +h=35786400 +ellps=WGS84 +units=m +sweep=y +no_defs +type=crs"
    );
    printf("%d\n", proj_is_equivalent_to_with_ctx(
        context, pj1, pj2, PJ_COMP_EQUIVALENT
    ));
    return 0;
}

Problem description

I'm using pyproj and end up comparing two CRS objects. One is created from a and rf parameters taken from a satellite instrument data file (pj1 above). The other is taken from a configuration for the expected/documented/ideal version of this CRS (pj2 above). The instrument/data file is documented as being on an WGS84 ellipsoid (my understanding at least). I expected that these two sets of parameters would be equivalent. I haven't had the time yet to determine if they were in older versions of PROJ.

pyproj4/pyproj#1284

Expected Output

1 meaning the CRSes are equivalent.

Environment Information

  • PROJ version (proj): Rel. 9.1.1, December 1st, 2022
  • Operation System Information: PopOS/Ubuntu

Installation method

  • conda via conda-forge package
@djhoese djhoese added the bug label May 11, 2023
@rouault rouault self-assigned this May 11, 2023
rouault added a commit to rouault/PROJ that referenced this issue May 11, 2023
…psoid' datum name...

...when instanciating from known +a,+rf

and change WGS84 -> WGS 84 and GRS80 -> GRS 1980 to use EPSG names
when building from +ellps=WGS84/GRS80 (fixes OSGeo#3725)

Now we get
```
$ bin/projinfo  "+proj=geos +lon_0=0 +h=35786400 +ellps=WGS84 +units=m +sweep=y +no_defs +type=crs"
PROJ.4 string:
+proj=geos +lon_0=0 +h=35786400 +x_0=0 +y_0=0 +ellps=WGS84 +units=m +no_defs +type=crs

WKT2:2019 string:
PROJCRS["unknown",
    BASEGEOGCRS["unknown",
        DATUM["Unknown based on WGS 84 ellipsoid",
            ELLIPSOID["WGS 84",6378137,298.257223563,
                LENGTHUNIT["metre",1],
                ID["EPSG",7030]]],
        PRIMEM["Greenwich",0,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8901]]],
    CONVERSION["unknown",
        METHOD["Geostationary Satellite (Sweep Y)"],
        PARAMETER["Longitude of natural origin",0,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8802]],
        PARAMETER["Satellite Height",35786400,
            LENGTHUNIT["metre",1,
                ID["EPSG",9001]]],
        PARAMETER["False easting",0,
            LENGTHUNIT["metre",1],
            ID["EPSG",8806]],
        PARAMETER["False northing",0,
            LENGTHUNIT["metre",1],
            ID["EPSG",8807]]],
    CS[Cartesian,2],
        AXIS["(E)",east,
            ORDER[1],
            LENGTHUNIT["metre",1,
                ID["EPSG",9001]]],
        AXIS["(N)",north,
            ORDER[2],
            LENGTHUNIT["metre",1,
                ID["EPSG",9001]]]]

$ bin/projinfo  "+proj=geos +lon_0=0 +h=35786400 +a=6378137.0 +rf=298.257223563 +units=m +sweep=y +no_defs +type=crs"
PROJ.4 string:
+proj=geos +lon_0=0 +h=35786400 +x_0=0 +y_0=0 +ellps=WGS84 +units=m +no_defs +type=crs

WKT2:2019 string:
PROJCRS["unknown",
    BASEGEOGCRS["unknown",
        DATUM["Unknown based on WGS 84 ellipsoid",
            ELLIPSOID["WGS 84",6378137,298.257223563,
                LENGTHUNIT["metre",1,
                    ID["EPSG",9001]]]],
        PRIMEM["Greenwich",0,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8901]]],
    CONVERSION["unknown",
        METHOD["Geostationary Satellite (Sweep Y)"],
        PARAMETER["Longitude of natural origin",0,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8802]],
        PARAMETER["Satellite Height",35786400,
            LENGTHUNIT["metre",1,
                ID["EPSG",9001]]],
        PARAMETER["False easting",0,
            LENGTHUNIT["metre",1],
            ID["EPSG",8806]],
        PARAMETER["False northing",0,
            LENGTHUNIT["metre",1],
            ID["EPSG",8807]]],
    CS[Cartesian,2],
        AXIS["(E)",east,
            ORDER[1],
            LENGTHUNIT["metre",1,
                ID["EPSG",9001]]],
        AXIS["(N)",north,
            ORDER[2],
            LENGTHUNIT["metre",1,
                ID["EPSG",9001]]]]
```
@djhoese
Copy link
Contributor Author

djhoese commented May 12, 2023

For the record, this seems to work as expected in PROJ 9.0.x but not 9.1.x.

rouault added a commit that referenced this issue May 12, 2023
…psoid' datum name...

...when instanciating from known +a,+rf

and change WGS84 -> WGS 84 and GRS80 -> GRS 1980 to use EPSG names
when building from +ellps=WGS84/GRS80 (fixes #3725)

Now we get
```
$ bin/projinfo  "+proj=geos +lon_0=0 +h=35786400 +ellps=WGS84 +units=m +sweep=y +no_defs +type=crs"
PROJ.4 string:
+proj=geos +lon_0=0 +h=35786400 +x_0=0 +y_0=0 +ellps=WGS84 +units=m +no_defs +type=crs

WKT2:2019 string:
PROJCRS["unknown",
    BASEGEOGCRS["unknown",
        DATUM["Unknown based on WGS 84 ellipsoid",
            ELLIPSOID["WGS 84",6378137,298.257223563,
                LENGTHUNIT["metre",1],
                ID["EPSG",7030]]],
        PRIMEM["Greenwich",0,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8901]]],
    CONVERSION["unknown",
        METHOD["Geostationary Satellite (Sweep Y)"],
        PARAMETER["Longitude of natural origin",0,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8802]],
        PARAMETER["Satellite Height",35786400,
            LENGTHUNIT["metre",1,
                ID["EPSG",9001]]],
        PARAMETER["False easting",0,
            LENGTHUNIT["metre",1],
            ID["EPSG",8806]],
        PARAMETER["False northing",0,
            LENGTHUNIT["metre",1],
            ID["EPSG",8807]]],
    CS[Cartesian,2],
        AXIS["(E)",east,
            ORDER[1],
            LENGTHUNIT["metre",1,
                ID["EPSG",9001]]],
        AXIS["(N)",north,
            ORDER[2],
            LENGTHUNIT["metre",1,
                ID["EPSG",9001]]]]

$ bin/projinfo  "+proj=geos +lon_0=0 +h=35786400 +a=6378137.0 +rf=298.257223563 +units=m +sweep=y +no_defs +type=crs"
PROJ.4 string:
+proj=geos +lon_0=0 +h=35786400 +x_0=0 +y_0=0 +ellps=WGS84 +units=m +no_defs +type=crs

WKT2:2019 string:
PROJCRS["unknown",
    BASEGEOGCRS["unknown",
        DATUM["Unknown based on WGS 84 ellipsoid",
            ELLIPSOID["WGS 84",6378137,298.257223563,
                LENGTHUNIT["metre",1,
                    ID["EPSG",9001]]]],
        PRIMEM["Greenwich",0,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8901]]],
    CONVERSION["unknown",
        METHOD["Geostationary Satellite (Sweep Y)"],
        PARAMETER["Longitude of natural origin",0,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8802]],
        PARAMETER["Satellite Height",35786400,
            LENGTHUNIT["metre",1,
                ID["EPSG",9001]]],
        PARAMETER["False easting",0,
            LENGTHUNIT["metre",1],
            ID["EPSG",8806]],
        PARAMETER["False northing",0,
            LENGTHUNIT["metre",1],
            ID["EPSG",8807]]],
    CS[Cartesian,2],
        AXIS["(E)",east,
            ORDER[1],
            LENGTHUNIT["metre",1,
                ID["EPSG",9001]]],
        AXIS["(N)",north,
            ORDER[2],
            LENGTHUNIT["metre",1,
                ID["EPSG",9001]]]]
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants