Opened 19 years ago

Last modified 19 years ago

#804 closed defect (worksforme)

having troubles with EPSG:3005

Reported by: jhayes@… Owned by: warmerdam
Priority: high Milestone:
Component: default Version: unspecified
Severity: normal Keywords:
Cc:

Description

I'm tring to make an OGRSpatialReference object as follows:

      OGRSpatialReference spatialRef;
      OGRErr err = OGRERR_NONE;
      int epsg = 3005;

      err = spatialRef.importFromEPSG(epsg);
      if(err != OGRERR_NONE)
         fprintf(stderr, "**********  ERROR calling importFromEPSG()\n");
      
      err = spatialRef.Validate();
      if(err != OGRERR_NONE)
         fprintf(stderr, "**********  WKT IS NOT VALID\n");
      
      char *wkt = NULL;
      if(spatialRef.exportToWkt(&wkt) == OGRERR_NONE && wkt)
         printf("%s\n", wkt);
      
      if(wkt) CPLFree(wkt);

It is failing inside importFromEPSG().  After some debugging I found it is
failing in ogr_fromepsg.cpp:SetEPSGProjCS() on the switch for nProjMethod =
9822.  Is this not a supported ProjMethod or is it an error in the pcs.csv file?

Note: EPSG:2964 also fails in the same way.

Change History (2)

comment:1 by warmerdam, 19 years ago

John,

importFromEPSG(3005) is working fine for me.  

9822 is Albers Conic Equal Area and was only added in 
ogr_fromepsg.cpp in April/2004.  Any chance you are using a
relatively old version of GDAL?  The other common problem is not
finding the EPSG support files, but if most coordinate systems
are working that is not likely the issue. 

Any chance you are not using the standard GDAL EPSG support .csv files? 

BTW, the WKT I get is:

WKT[EPSG:3005] =
PROJCS["NAD83 / BC Albers",
    GEOGCS["NAD83",
        DATUM["North_American_Datum_1983",
            SPHEROID["GRS 1980",6378137,298.257222101,
                AUTHORITY["EPSG","7019"]],
            AUTHORITY["EPSG","6269"]],
        PRIMEM["Greenwich",0,
            AUTHORITY["EPSG","8901"]],
        UNIT["degree",0.01745329251994328,
            AUTHORITY["EPSG","9122"]],
        AUTHORITY["EPSG","4269"]],
    PROJECTION["Albers_Conic_Equal_Area"],
    PARAMETER["standard_parallel_1",50],
    PARAMETER["standard_parallel_2",58.5],
    PARAMETER["latitude_of_center",45],
    PARAMETER["longitude_of_center",-126],
    PARAMETER["false_easting",1000000],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AUTHORITY["EPSG","3005"]]

I actually test this with the "testepsg" program that can be built
in the gdal/ogr directory (nmake /f makefile.vc testepsg.exe) and then
execute it something like:

testepsg.exe EPSG:3005


comment:2 by warmerdam, 19 years ago

John reports he is using GDAL 1.2.0 which definately pre-dates
the support for ACEA. 

I will close this now ... please re-open if your problem persists
with a modern GDAL.

Note: See TracTickets for help on using tickets.