[gdal-dev] Identify EPSG SRS_ID from Shapefile SRS Definition
Even Rouault
even.rouault at mines-paris.org
Thu Sep 29 14:11:56 EDT 2011
Le jeudi 29 septembre 2011 19:21:15, Tony.Na at sybase.com a écrit :
> 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:
Tony,
Yes, there is a kind of "standard" form of WKT used by GDAL, and ESRI WKT
which has various variations, including the stripping of authority nodes, but
also different PROJCS, DATUM or GEOGCS names, or different name for projection
and projection parameters... This is really complex magic ( just have a look
at ogr/ogr_srs_esri.cpp )
>
> 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:
>
> 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.
I'm afraid it is not possible in the general case and there's no obvious
solution to fix it. AutoIdentifyEPSG() only works for just a few SRS, as
documented.
I believe that you're not alone to run into this issue : other drivers might
need to know the EPSG code as a key to identify the SRS. So I would advise you
to consider it as something not in the scope of your driver (or if you want to
improve that area, please improve AutoIdentifyEPSG() but not add hacks in your
new driver to workaround ti). You would not run into this issue with other
drivers than shapefile that keep the full WKT. In the meantime, users can
override the SRS on the ogr2ogr command line with -s_srs EPSG:xxx ...
Best regards,
Even
>
> Thanks,
> - Tony Na
More information about the gdal-dev
mailing list