Opened 6 years ago

Closed 4 years ago

#6188 closed enhancement (fixed)

OSRAutoIdentifyEPSG does not identify EPSG 3358 (North Carolina)

Reported by: Markus Neteler Owned by: warmerdam
Priority: normal Milestone: 2.3.0
Component: default Version: 1.11.2
Severity: normal Keywords: AutoIdentifyEPSG, GetAuthorityCode
Cc: krejcmat

Description

In GRASS GIS 7, we use OSRAutoIdentifyEPSG() to identify projections in the current GRASS GIS location in case that the PROJ_EPSG file is absent from the PERMANENT/ folder.

The Python script for that is this: https://trac.osgeo.org/grass/browser/grass-addons/grass7/general/g.proj.identify/g.proj.identify.py

which calls srs.AutoIdentifyEPSG() and the srs.GetAuthorityCode?(). Unfortunately, the detection of the EPSG code of the OSGeo sample dataset North Carolina fails:

GRASS 7.0.2svn (nc_spm_08_grass7):~ > g.proj -p
-PROJ_INFO-------------------------------------------------
name       : Lambert Conformal Conic
proj       : lcc
datum      : nad83
a          : 6378137.0
es         : 0.006694380022900787
lat_1      : 36.16666666666666
lat_2      : 34.33333333333334
lat_0      : 33.75
lon_0      : -79
x_0        : 609601.22
y_0        : 0
no_defs    : defined
-PROJ_UNITS------------------------------------------------
unit       : Meter
units      : Meters
meters     : 1

GRASS 7.0.2svn (nc_spm_08_grass7):~ > g.proj -w
PROJCS["Lambert Conformal Conic",
    GEOGCS["grs80",
        DATUM["North_American_Datum_1983",
            SPHEROID["Geodetic_Reference_System_1980",6378137,298.257222101]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433]],
    PROJECTION["Lambert_Conformal_Conic_2SP"],
    PARAMETER["standard_parallel_1",36.16666666666666],
    PARAMETER["standard_parallel_2",34.33333333333334],
    PARAMETER["latitude_of_origin",33.75],
    PARAMETER["central_meridian",-79],
    PARAMETER["false_easting",609601.22],
    PARAMETER["false_northing",0],
    UNIT["Meter",1]]

GRASS 7.0.2svn (nc_spm_08_grass7):~ > g.extension g.proj.identify 
Fetching <g.proj.identify> from GRASS-Addons SVN repository (be patient)...
Compiling...
Installing...
Updating addons metadata file...
Installation of <g.proj.identify> successfully finished

GRASS 7.0.2svn (nc_spm_08_grass7):~ > g.proj.identify
ERROR: EPSG code cannot be identified

Could this detection be fixed? Or is it a bug at our end?

Change History (2)

comment:1 Changed 6 years ago by Even Rouault

Milestone: 1.11.4
Type: defectenhancement

AutoIdentifyEPSG() doc advertizes very limited capabilities : see http://www.gdal.org/classOGRSpatialReference.html#acb0373c83927bfd694048da6f79e33ea

Something more general would acknowledgly be much needed, but is non trivial work and would involve probably some fuzzy matching to deal with inexact datum / ellipsoid names, missing TOWGS84, etc.. (especially when dealing with WKT coming from ESRI for example)

comment:2 Changed 4 years ago by Even Rouault

Milestone: 2.3.0
Resolution: fixed
Status: newclosed

OSRFindMatches() added in GDAL trunk should help

$ gdalsrsinfo -e 'PROJCS["Lambert Conformal Conic",
>     GEOGCS["grs80",
>         DATUM["North_American_Datum_1983",
>             SPHEROID["Geodetic_Reference_System_1980",6378137,298.257222101]],
>         PRIMEM["Greenwich",0],
>         UNIT["degree",0.0174532925199433]],
>     PROJECTION["Lambert_Conformal_Conic_2SP"],
>     PARAMETER["standard_parallel_1",36.16666666666666],
>     PARAMETER["standard_parallel_2",34.33333333333334],
>     PARAMETER["latitude_of_origin",33.75],
>     PARAMETER["central_meridian",-79],
>     PARAMETER["false_easting",609601.22],
>     PARAMETER["false_northing",0],
>     UNIT["Meter",1]]'

EPSG:32119
Note: See TracTickets for help on using tickets.