[MetaCRS] Oracle WKT

Hugues Wisniewski hugues.wisniewski at autodesk.com
Fri Jul 25 14:30:45 EDT 2008


Hi all,

As Frank pointed out Cs-Map is a library that is handling Oracle WKT. A lot of time and energy has been spent generating the various WKT flavor mappings.
Reusing this library would save a lot of energy which could be redirected to improving this mapping when a missing entry is found.
Improving the mapping is also an ongoing task so if everyone contributed that would concentrate the energy on a single piece of code.

Cs-Map is a MetaCRS project: http://svn.osgeo.org/metacrs/csmap/trunk/CsMapDev/
Norm Olsen is more familiar with the actual API then myself since he designed it.

Another possible near future route is the use of another open source high level API in the MapGuide project that handles WKT conversions. The MapGuide code is available here: http://svn.osgeo.org/mapguide/trunk/MgDev/
It currently uses PROJ4 and will soon also support Cs-Map

The syntax to convert a WKT string "sWkt" to a coordinate system is something like this:

    MgCoordinateSystemFactory factory;
    Ptr<MgCoordinateSystemCatalog> pCatalog=factory.GetCatalog();
    Ptr<MgCoordinateSystemFormatConverter> pConverter=pCatalog->GetFormatConverter();

    //convert the WKT to a coordinate system
    //the API is smart enough to identify the flavor: Oracle version 9 or 10, Ogc, EPSG, ESRI, ...
    Ptr<MgCoordinateSystem> pCs= pConverter->WktToDefinition(MgCoordinateSystemWktFlavor::Unknown, sWkt);

    //convert the WKT to an EPSG code
    STRING sEPSG=pConverter->WktToCode(MgCoordinateSystemWktFlavor::Unknown, sWkt, MgCoordinateSystemCodeFormat::Epsg);

    //convert the CS back to a WKT of a different flavor
    STRING sWktOgc= pConverter->CodeToWkt(MgCoordinateSystemCodeFormat::Epsg, sEPSG, MgCoordinateSystemWktFlavor::Ogc);

Or

    STRING sWktOgc=pConverter->CodeToWkt(MgCoordinateSystemCodeFormat::Epsg, sEPSG, MgCoordinateSystemWktFlavor::Ogc);
    STRING sWktOgc=pConverter->DefinitionToWkt(pCs, MgCoordinateSystemWktFlavor::Ogc);

That is a simple syntax.
If there's a missing entry in the low level mapping, this can fixed by editing the mapping text file.

Hugues

-----Original Message-----
From: metacrs-bounces at lists.osgeo.org [mailto:metacrs-bounces at lists.osgeo.org] On Behalf Of Frank Warmerdam (External)
Sent: Thursday, July 24, 2008 12:50 PM
To: Norm Olsen
Cc: metacrs at lists.osgeo.org
Subject: Re: [MetaCRS] Oracle WKT

Norm Olsen wrote:
> Hello Frank . . .
>
> Yes, Oracle 10 is significantly different from Oracle 9.  Never seen an Oracle 8, I don't think.  Could you send me some samples?

Norm,

Currently we only have Oracle 10 installed, but traditionally the OGR
Oracle spatial driver worked back as far as Oracle 8.  Have you seen
the WKT definitions for Oracle 11?  I wonder if we could provide some
advice to Oracle for future move to a more standard form.  Perhaps we
could do this with a clue-bat. :-)

> Most all of these issues have been addressed in CS-MAP.  Off the top of my head, the issues are:
>
> 1> The names of the definitions are all different, and most now include an EPSG reference.  This can be helpful, but cannot be relied upon.
>
> 2> The PROJECTION element now rarely contains the name of a projection, but has a reference to an EPSG Coordinate System Operation definition.  This is not the EPSG Operation _Method_ code, it is an EPSG Coordinate _Operation_ code.  A table which mapped the EPSG Operation Code to a projection was built to CS-MAP to handle this.  Of course, this is a maintenance nightmare.
>
> 3> In some cases, there are no PARAMETER elements for the coordinate system definition.  Presumably, having the EPSG Coordinate Operation Code you can get the parameter values from the EPSG database.  Perhaps for Oracle this is a piece of cake; not so for us mere mortals.
>
> 4> Oracle 10 will now often include datum transformation parameters, but without the benefit of the TOWGS84 element.  Of course, this presents all the problems associated with the TOWGS84 element.  Code that parses the DATUM element will need to be able to handle these extra seven parameter values appropriately.  (I think there are always seven, my memory could be wrong.)
>
> 5> Many numerical values are given to 20 or so decimal places; could cause problems with some parsers.
>
> Handling Oracle 10 was your typical WKT pain in the posterior problem.  Distinguishing between 9 and 10 is also tricky, which we needed to do.  My condolences to whomever has to do this.  I am available for consultation and, perhaps more importantly, consolation and commiseration.

Excellent information!  I can see this will be somewhat harder than
the modest massaging I do for ESRI WKT.

I gather the CS-MAP code will be public shortly, so perhaps when that
occurs you could provide a few pointers to the corresponding code in the
CS-MAP code tree.

Looking up EPSG GCS or PCS codes is easy in my context which at least
might help.

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org

_______________________________________________
MetaCRS mailing list
MetaCRS at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/metacrs


More information about the MetaCRS mailing list