[MetaCRS] RE: EPSG Code to Coordinate System
Norm Olsen
norm.olsen at autodesk.com
Wed Jan 26 11:57:05 EST 2011
Hello Chris . . .
The population of the epgsNbr in the coordinate system dictionary is a relatively new thing. While the field was there for several releases, it was only in this last release that it was properly populated. There are many gaps as not all of the systems defined in CS-MAP have (or have had) EPSG codes assigned to them. Hopefully, the mapping is now complete to the extent that a correspondence exists.
There is a lot of history behind the rather complicated code in the MapGuide API and CS-MAP. Over the course of 12 years, the library was being maintained separately by Mentor and Autodesk (Mentor as a vendor, Autodesk as a user). So, you’ll see lots of strange complexities and duplications in the code due mostly to the legacy of the 22 year old product.
The suggested means of converting an EPSG code to a CS-MAP name, or any other type of definition mapping, is to use the NameMapper facility. The interfaces supported by this facility are all declared in csNameMapperSupport.h. The facility itself is declared in csNameMapper.hpp and implemented in csNameMapper.cpp. The functionality is based on the content of the NameMapper.csv file. Note, that (obviously) the NameMapper.csv file needs to read into memory at some point. This will happen the first time a NameMapper function is called. Thus, you will see a slight pause for the first call; subsequent calls should perform well for the intended use case of simply looking up a code or two.
The intent of this facility is to support the various flavors of WKT and hopefully do so in a manner where a new flavor can be added without having to change any code. Theoretically, that should be possible; pragmatically it has yet to be tried. In any case, the NameMapper should enable you to convert from any one flavor of name or code to any other flavor of name or code; and do so for coordinate systems (geographic and/or projective), datums, ellipsoids, projections, projection parameters, units, etc.
Norm
--
Norm Olsen
Software Engineer
Autodesk, Inc.
303-277-9967
From: metacrs-bounces at lists.osgeo.org [mailto:metacrs-bounces at lists.osgeo.org] On Behalf Of Steve Stanton
Sent: Wednesday, January 26, 2011 1:11 AM
To: metacrs at lists.osgeo.org
Subject: Re: [MetaCRS] RE: EPSG Code to Coordinate System
Hi Hugues,
I was looking through the code you mention, and I started to wonder why it's so complicated. Would it not be possible to loop through the the coordinate systems using CS_csrd and look at the value of the epsgNbr field in the cs_Csdef_ struct?
Or is the epsgNbr field no longer utilized? (I see it's defined in only about half of the systems).
Steve
--- On Wed, 26/1/11, Hugues Wisniewski <hugues.wisniewski at autodesk.com> wrote:
From: Hugues Wisniewski <hugues.wisniewski at autodesk.com>
Subject: [MetaCRS] RE: EPSG Code to Coordinate System
To: "Chris Gibson" <Chris.Gibson at divestco.com>, "metacrs at lists.osgeo.org" <metacrs at lists.osgeo.org>
Date: Wednesday, 26 January, 2011, 0:22
Hello Chris,
For this kind of activity an example is always welcome ;-) and here’s how it’s done in the MapGuide API for future reference
The method is CCoordinateSystemFormatConverter::CodeToCode in the file:
http://svn.osgeo.org/mapguide/trunk/MgDev/Common/CoordinateSystem/CoordSysFormatConverter.cpp
The Cs-Map API being used is CSepsg2adskCS.
And if EPSG is the target CSadsk2epsgCS is the one.
CS_epsg2msi sounds like a dead prototype that would have to be removed from Cs-Map
Feel free to create a ticket for that and it will be taken care of
Thanks
Hugues
From: metacrs-bounces at lists.osgeo.org [mailto:metacrs-bounces at lists.osgeo.org] On Behalf Of Chris Gibson
Sent: Tuesday, January 25, 2011 3:33 PM
To: metacrs at lists.osgeo.org
Subject: [MetaCRS] EPSG Code to Coordinate System
I have a need to convert an EPSG code to the Coordinate System descriptor. I thought the function CS_epsg2msi would do what I want, this is in the header file, but no function exists in the source code, so I get an unresolved external.
Am I missing something?
What should I be using?
Thanks
Chris Gibson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/metacrs/attachments/20110126/448e1319/attachment-0001.html
More information about the MetaCRS
mailing list