Print This Post

CRS Registry Supports Well-Known Text

Recently, the IOGP (International Association of Oil and Gas Producers) announced support for the Open Geospatial Consortium’s (OGC) Well–Known Text (WKT) encoding for Coordinate Systems (see http://www.directionsmag.com/pressreleases/iogp-releases-coordinate-reference-system-definitions-in-well-known-text-fo/427321). This is a new addition to the Geography Markup Language (GML) encoding that has been supported for many years.

Well-Known Text is similar to GML, except that instead of the grammar being determined by XML and XML Schema, it is defined by an Extended Backus-Naur grammar file specific to Coordinate Reference Systems (see http://en.wikipedia.org/wiki/Extended_Backus-Naur_Form). Unlike GML, where any XML parser will do (of which any number of generic parsers are freely available), reading Well-Known Text encodings requires a purpose-built parser. Fortunately, there are some Well-Known parsers around such as the OGC GeoTools CRS.parseWKT (see http://svn.osgeo.org/geotools/branches/plugin/docs/user/library/referencing/crs.txt), and the prototype parser ogc-crs-wkt-parser, offered in open source by ESRI at https://github.com/Esri/ogc-crs-wkt-parser. Some commercial GIS products such as ESRI’s ArcGIS Server can also read and interpret the Well-Known Text CRS encoding.

Any Coordinate Reference System (CRS), or CRS support component such as a Meridian or Earth Model, can be requested from the CRS Registry — the CRS registry retrieves GML and then transforms it into Well-Known Text. The Registry user searches for and selects the CRS of interest in the usual manner, and then clicks the GML or WKT key to get the CRS in the desired encoding.

EPSG Registry Download Page

The GML encoding is the “master” encoding and the WKT encoding is derived from it.

The Well-Known Text encoding is slightly more compact than the GML encoding as can be seen in the following examples:

Well-Known Text Encoding for EPSG:4326:

1
2
3
4
5
6
7
8
GEODCRS["WGS 84",
  DATUM["World Geodetic System 1984",
    ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1.0]]],
  CS[ellipsoidal,2],
    AXIS["latitude",north,ORDER[1]],
    AXIS["longitude",east,ORDER[2]],
    ANGLEUNIT["degree",0.01745329252],
  ID["EPSG",4326]]

GML Encoding for EPSG:4326 with metadata removed:

1
2
3
4
5
6
7
8
9
10
11
12
13
<gml:GeodeticCRS xmlns:epsg="urn:x-ogp:spec:schema-xsd:EPSG:1.0:dataset" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:xlink="http://www.w3.org/1999/xlink" gml:id="epsg-crs-4326">
    <epsg:projectionConversion
        xlink:href="urn:ogc:def:coordinateOperation:EPSG::15593"/>
    <epsg:sourceGeographicCRS xlink:href="urn:ogc:def:crs:EPSG::4979"/>
    <gml:identifier codeSpace="OGP">urn:ogc:def:crs:EPSG::4326</gml:identifier>
    <gml:name>WGS 84</gml:name>
    <gml:domainOfValidity xlink:href="urn:ogc:def:area:EPSG::1262"/>
    <gml:scope>
        Horizontal component of 3D system. Used by the GPS satellite navigation system and for NATO military geodetic surveying.
    </gml:scope>
    <gml:ellipsoidalCS xlink:href="urn:ogc:def:cs:EPSG::6422"/>
    <gml:geodeticDatum xlink:href="urn:ogc:def:datum:EPSG::6326"/>
</gml:GeodeticCRS>

Note that the GML encoding contains some additional information, namely the “domain of validity”, CRS scope, projectionConversion, and sourceGeographicCRS, and that in GML a global identifier is assigned to the CRS and to all of the support components. Note also that the GML encoding is completely normalized.

For example, the Ellipsoidal Coordinate System (EPSG:6422) can be separately retrieved and, with metadata removed, appears as follows:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<gml:EllipsoidalCS xmlns:epsg="urn:x-ogp:spec:schema-xsd:EPSG:1.0:dataset" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:xlink="http://www.w3.org/1999/xlink" gml:id="epsg-cs-6422">
<gml:identifier codeSpace="OGP">urn:ogc:def:cs:EPSG::6422</gml:identifier>
<gml:name>
Ellipsoidal 2D CS. Axes: latitude, longitude. Orientations: north, east. UoM: degree
</gml:name>
<gml:remarks>
Coordinates referenced to this CS are in degrees. Any degree representation (e.g. DMSH, decimal, etc.) may be used but that used must be declared for the user by the supplier of data. Used in geographic 2D coordinate reference systems.
</gml:remarks>
<gml:axis>
<gml:CoordinateSystemAxis gml:id="epsg-axis-106" uom="urn:ogc:def:uom:EPSG::9122">
<gml:descriptionReference xlink:href="urn:ogc:def:axis-name:EPSG::9901"/>
<gml:identifier codeSpace="OGP">urn:ogc:def:axis:EPSG::106</gml:identifier>
<gml:axisAbbrev>Lat</gml:axisAbbrev>
<gml:axisDirection codeSpace="EPSG">north</gml:axisDirection>
</gml:CoordinateSystemAxis>
</gml:axis>
<gml:axis>
<gml:CoordinateSystemAxis gml:id="epsg-axis-107" uom="urn:ogc:def:uom:EPSG::9122">
<gml:descriptionReference xlink:href="urn:ogc:def:axis-name:EPSG::9902"/>
<gml:identifier codeSpace="OGP">urn:ogc:def:axis:EPSG::107</gml:identifier>
<gml:axisAbbrev>Long</gml:axisAbbrev>
<gml:axisDirection codeSpace="EPSG">east</gml:axisDirection>
</gml:CoordinateSystemAxis>
</gml:axis>
</gml:EllipsoidalCS>

The GML encoding also carries metadata (which was deleted in the example above) about the CRS such as the change records that reflect the development of the CRS over time. While this is essential to many professional geodesists, and in particular to those involved with developing and maintaining coordinate reference systems, the stripped down, denormalized version in WKT is sufficient for many general users.

The WKT encoding of a CRS can also be requested as a web service, as shown in the following example:

http://www.epsg-registry.org/export.htm?wkt=urn:ogc:def:crs:EPSG::2043

If you are primarily a consumer of CRS definitions, the WKT encoding may well be sufficient. If you are a creator of CRS definitions, on the other hand, the GML encoding is a much better choice. In either case, both are supported by the Galdos-powered CRS registry from the IOGP.