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

Wrong identification of ESRI WKT to deprecated EPSG:2292 instead of EPSG:2954 #2116

Closed
rouault opened this issue Mar 30, 2020 · 5 comments
Closed
Labels

Comments

@rouault
Copy link
Member

rouault commented Mar 30, 2020

$ projinfo --identify 'PROJCS["NAD_1983_CSRS_Prince_Edward_Island",GEOGCS["GCS_North_American_1983_CSRS",DATUM["D_North_American_1983_CSRS",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Double_Stereographic"],PARAMETER["False_Easting",400000.0],PARAMETER["False_Northing",800000.0],PARAMETER["Central_Meridian",-63.0],PARAMETER["Scale_Factor",0.999912],PARAMETER["Latitude_Of_Origin",47.25],UNIT["Meter",1.0]]'

returns EPSG:2292: 100 %

But EPSG:2292 is deprecated. It should rather return EPSG:2954

Comes from qgis/QGIS#35459

@rouault rouault added the bug label Mar 30, 2020
rouault added a commit to rouault/PROJ that referenced this issue Mar 30, 2020
rouault added a commit to rouault/PROJ that referenced this issue Mar 30, 2020
@tveinot
Copy link

tveinot commented Mar 30, 2020

Just adding to this from the original issue brough up in the QGIS portion:
Since this went out as an issue with PROJ I have andother question; So since moving to PEI I have been using 2954 in both Esri and QGIS. Esri says it is a "Double Stereographic Projection" but QGIS says it is a "Stereographic Projection" other sites like epsg.io/2954 say it is "Stereographic" yet The Government of PEI http://www.gov.pe.ca/gis/index.php3?number=77865&lang=J calls it a "Stereographic Double Projection" University of Prince Eward Island calls it a "Double Stereographic Projection" and NR Can doesn't seem to specify. The locals and the surveyors that are using 2954 (we still have a stubbron group using NAD27 Imperial lol), they say it is indeed a Double Stereographic Projection. Should this also be addressed? How do we find out who is right?

PROJ-BOT pushed a commit to PROJ-BOT/PROJ that referenced this issue Mar 30, 2020
rouault added a commit that referenced this issue Mar 30, 2020
[Backport 6.3] ESRI_WKT ingestion: make sure to identify to non-deprecated EPSG entry when possible (fixes #2116)
@jmckenna
Copy link
Contributor

Confirmed the fix (with some odd errors):

Testing environment

Visual Studio 2017
proj-master
with-curl, with-sqlite3, with-tiff.

Before Fix

Using the exact command as in the ticket description:

projinfo --identify 'PROJCS["NAD_1983_CSRS_Prince_Edward_Island",GEOGCS["GCS_North_American_1983_CSRS",DATUM["D_North_American_1983_CSRS",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Double_Stereographic"],PARAMETER["False_Easting",400000.0],PARAMETER["False_Northing",800000.0],PARAMETER["Central_Meridian",-63.0],PARAMETER["Scale_Factor",0.999912],PARAMETER["Latitude_Of_Origin",47.25],UNIT["Meter",1.0]]'

Error

input string: parsing of user string failed: unrecognized format / unknown name

Second try

Removing the single quotes around the WKT:

projinfo --identify PROJCS["NAD_1983_CSRS_Prince_Edward_Island",GEOGCS["GCS_North_American_1983_CSRS",DATUM["D_North_American_1983_CSRS",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Double_Stereographic"],PARAMETER["False_Easting",400000.0],PARAMETER["False_Northing",800000.0],PARAMETER["Central_Meridian",-63.0],PARAMETER["Scale_Factor",0.999912],PARAMETER["Latitude_Of_Origin",47.25],UNIT["Meter",1.0]]

Success (matches 2292), with warning

Warning: Parsing error : syntax error, unexpected identifier, expecting string. Error occurred around:
PROJCS[NAD_1983_CSRS_Prince_Edward_Island,GEOGC
       ^
PROJ.4 string:
+proj=sterea +lat_0=47.25 +lon_0=-63 +k=0.999912 +x_0=400000 +y_0=800000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +type=crs

WKT2:2019 string:
PROJCRS["NAD83(CSRS98) / Prince Edward Isl. Stereographic (NAD83)",
    BASEGEOGCRS["NAD83(CSRS98)",
        DATUM["NAD83 Canadian Spatial Reference System",
            ELLIPSOID["GRS 1980",6378137,298.257222101,
                LENGTHUNIT["metre",1]],
            ID["EPSG",6140]],
        PRIMEM["Greenwich",0,
            ANGLEUNIT["Degree",0.0174532925199433]]],
    CONVERSION["unnamed",
        METHOD["Oblique Stereographic",
            ID["EPSG",9809]],
        PARAMETER["Latitude of natural origin",47.25,
            ANGLEUNIT["Degree",0.0174532925199433],
            ID["EPSG",8801]],
        PARAMETER["Longitude of natural origin",-63,
            ANGLEUNIT["Degree",0.0174532925199433],
            ID["EPSG",8802]],
        PARAMETER["Scale factor at natural origin",0.999912,
            SCALEUNIT["unity",1],
            ID["EPSG",8805]],
        PARAMETER["False easting",400000,
            LENGTHUNIT["metre",1],
            ID["EPSG",8806]],
        PARAMETER["False northing",800000,
            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]]]]

Identification match count: 1
EPSG:2292: 100 %

After Fix

Using the exact command as in the ticket description:

projinfo --identify 'PROJCS["NAD_1983_CSRS_Prince_Edward_Island",GEOGCS["GCS_North_American_1983_CSRS",DATUM["D_North_American_1983_CSRS",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Double_Stereographic"],PARAMETER["False_Easting",400000.0],PARAMETER["False_Northing",800000.0],PARAMETER["Central_Meridian",-63.0],PARAMETER["Scale_Factor",0.999912],PARAMETER["Latitude_Of_Origin",47.25],UNIT["Meter",1.0]]'

Error

input string: parsing of user string failed: unrecognized format / unknown name

Second try

Removing the single quotes around the WKT:

projinfo --identify PROJCS["NAD_1983_CSRS_Prince_Edward_Island",GEOGCS["GCS_North_American_1983_CSRS",DATUM["D_North_American_1983_CSRS",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Double_Stereographic"],PARAMETER["False_Easting",400000.0],PARAMETER["False_Northing",800000.0],PARAMETER["Central_Meridian",-63.0],PARAMETER["Scale_Factor",0.999912],PARAMETER["Latitude_Of_Origin",47.25],UNIT["Meter",1.0]]

Success (matches 2954), with warning

Warning: Parsing error : syntax error, unexpected identifier, expecting string. Error occurred around:
PROJCS[NAD_1983_CSRS_Prince_Edward_Island,GEOGC
       ^
PROJ.4 string:
+proj=sterea +lat_0=47.25 +lon_0=-63 +k=0.999912 +x_0=400000 +y_0=800000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +type=crs

WKT2:2019 string:
PROJCRS["NAD83(CSRS) / Prince Edward Isl. Stereographic (NAD83)",
    BASEGEOGCRS["NAD83(CSRS)",
        DATUM["NAD83 Canadian Spatial Reference System",
            ELLIPSOID["GRS 1980",6378137,298.257222101,
                LENGTHUNIT["metre",1]],
            ID["EPSG",6140]],
        PRIMEM["Greenwich",0,
            ANGLEUNIT["Degree",0.0174532925199433]]],
    CONVERSION["unnamed",
        METHOD["Oblique Stereographic",
            ID["EPSG",9809]],
        PARAMETER["Latitude of natural origin",47.25,
            ANGLEUNIT["Degree",0.0174532925199433],
            ID["EPSG",8801]],
        PARAMETER["Longitude of natural origin",-63,
            ANGLEUNIT["Degree",0.0174532925199433],
            ID["EPSG",8802]],
        PARAMETER["Scale factor at natural origin",0.999912,
            SCALEUNIT["unity",1],
            ID["EPSG",8805]],
        PARAMETER["False easting",400000,
            LENGTHUNIT["metre",1],
            ID["EPSG",8806]],
        PARAMETER["False northing",800000,
            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]]]]

Identification match count: 1
EPSG:2954: 100 %

@jmckenna
Copy link
Contributor

Workaround for the Windows errors with --identify is to place the WKT in a text file (without any extra single quotes) and then point to the file as:

projinfo --identify @wkt.txt

Sorry for the noise.

rouault added a commit that referenced this issue Mar 31, 2020
[Backport 7.0] ESRI_WKT ingestion: make sure to identify to non-deprecated EPSG entry when possible (fixes #2116)
@jmckenna
Copy link
Contributor

@tveinot this change will be available in PROJ 6.3.2 which is targeted for release 1st May, and it may make it into QGIS 3.14.0 which is targeted for 14 May, but keep an eye on QGIS and speak out/nudge when needed ha. This fix should also help handling other deprecated Esri WKT as well. Thank you to @rouault for the quick fix! And hello from Nova Scotia.

@tveinot
Copy link

tveinot commented Mar 31, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants