[gdal-dev] Identify EPSG SRS_ID from Shapefile SRS Definition

Tony.Na at sybase.com Tony.Na at sybase.com
Thu Sep 29 13:21:15 EDT 2011


Hi fellow GDAL/OGR developers,
I'm currently developing an OGR data provider module for Sybase SQLAnywhere
database, which recently supports spatial features in it's version 12
release. I have a question regarding the best way to evaluate the
equivalence between two Spatial Reference Systems.  It seems to me that
when I use ogr2ogr to translate a SQLAnywhere Layer to a shapefile, the
shapefile data provider calls the morphToESRI() and morphFromESRI
functions, which strips out all Authority nodes from my original SRS WKT.
For example, for the SRS “NAD27 / Alaska Albers”, the WKT representation
before and after the morph follows:


Before morph:


PROJCS["Albers Equal Area",
      GEOGCS["NAD27",
            DATUM["North_American_Datum_1927",
                  SPHEROID["Clarke 1866", 6378206.4, 294.978698213898,
                        AUTHORITY["EPSG","7008"]],
                  TOWGS84[-3,142,183,0,0,0,0],
                  AUTHORITY["EPSG","6267"]],
            PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],
            UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9108"]],
            AUTHORITY["EPSG","4267"]],
      PROJECTION["Albers_Conic_Equal_Area"],
      PARAMETER["standard_parallel_1",55],
      PARAMETER["standard_parallel_2",65],
      PARAMETER["latitude_of_center",50],
      PARAMETER["longitude_of_center",-154],
      PARAMETER["false_easting",0],
      PARAMETER["false_northing",0],
      UNIT["us_survey_feet",0.3048006096012192],
      AUTHORITY["EPSG","2964"]]

After morph:
PROJCS["Albers_Equal_Area",
      GEOGCS["GCS_North_American_1927",
            DATUM["D_North_American_1927",
                  SPHEROID["Clarke_1866",6378206.4,294.9786982]],
            PRIMEM["Greenwich",0],
            UNIT["Degree",0.017453292519943295]],
      PROJECTION["Albers"],
      PARAMETER["standard_parallel_1",55],
      PARAMETER["standard_parallel_2",65],
      PARAMETER["latitude_of_origin",50],
      PARAMETER["central_meridian",-154],
      PARAMETER["false_easting",0],
      PARAMETER["false_northing",0]
      ,UNIT["Foot_US",0.30480060960121924]]

The problem arises when I try to use this exported shapefile as a source to
Ogr2ogr when creating a new SQLAnywhere layer, where I have to find the SRS
in our database. However, when I call the AutoIdentifyEPSG() function of
OGRSpatialReference system, I don’t get all the authority name and code
restored, here’s the resulting WKT for the above example:

After restore:

PROJCS["Albers_Equal_Area",
      GEOGCS["GCS_North_American_1927",
            DATUM["D_North_American_1927",
                  SPHEROID["Clarke_1866",6378206.4,294.9786982]],
            PRIMEM["Greenwich",0],
            UNIT["Degree",0.017453292519943295],
            AUTHORITY["EPSG","4267"]],
      PROJECTION["Albers"],
      PARAMETER["standard_parallel_1",55],
      PARAMETER["standard_parallel_2",65],
      PARAMETER["latitude_of_origin",50],
      PARAMETER["central_meridian",-154],
      PARAMETER["false_easting",0],
      PARAMETER["false_northing",0]
      ,UNIT["Foot_US",0.30480060960121924]]

My question is, what is the best way to test this WKT as the same SRS as my
original WKT, since the key identification AUTHORITY["EPSG","2964"]]  is
missing from the root node.  Thanks for your time.

Thanks,
- Tony Na


More information about the gdal-dev mailing list