Enum Convention

All Implemented Interfaces:
Serializable, Comparable<Convention>, Constable

public enum Convention extends Enum<Convention>
The convention to use for WKT formatting. This enumeration specifies whether to use the Well Known Text format defined by ISO 19162 (also known as “WKT 2”), or whether to use the format previously defined in OGC 01-009 (referenced as “WKT 1”).

WKT 1 variants

The WKT 2 format should be parsed and formatted consistently by all software products. But the WKT 1 format has been interpreted differently by various implementers. Apache SIS can adapt itself to different WKT variants, sometime automatically. But some aspects can not be guessed. One noticeable source of confusion is the unit of measurement of PRIMEM[…] and PARAMETER[…] elements:
  • The unit of the Prime Meridian shall be the angular unit of the enclosing Geographic CRS according the OGC 01-009 (Coordinate transformation services) specification.
  • An older specification — Simple Features — was unclear on this matter and has been interpreted by many software products as fixing the unit to decimal degrees.
  • Some software products support only (longitude, latitude) axis order and ignore completely all AXIS[…] elements in the WKT.
Despite the first interpretation being specified by both OGC 01-009 and ISO 19162 standards, the second interpretation appears to be in wide use for WKT 1. Apache SIS uses the standard interpretation by default, but the WKT1_COMMON_UNITS enumeration allows parsing and formatting using the older interpretation. The WKT1_IGNORE_AXES enumeration mimics the most minimalist WKT 1 parsers, but should be avoided when not imposed by compatibility reasons.
See Also:

Defined in the sis-referencing module

  • Enum Constant Details

    • WKT2

      public static final Convention WKT2
      The ISO 19162 format, also known as “WKT 2”. This convention follows the ISO recommendations.

      Unless otherwise specified by WKTFormat​.set­Name­Authority(Citation), projections and parameters formatted with this convention will use the EPSG names when available.

      This is the default convention used by Formattable­Object​.to­WKT() and for new WKTFormat instances.

      See Also:

      public static final Convention WKT2_SIMPLIFIED
      The ISO 19162 format with omission of some optional elements. This convention is identical to the WKT2 convention except for the following aspects:
      • By default long keywords are used instead of short ones (e.g. "Geodetic­CRS" instead of "Geod­CRS") except for the "Unit" keyword, because they match the class or interface names.
      • Prime­Meridian element omitted if the meridian is Greenwich.
      • Axis element omits the Order sub-element.
      • Unit elements are less verbose:
        • Ellipsoid and Vertical­Extent elements omit the Length­Unit sub-element if that unit is Units​.METRE.
        • Parameter elements omit the Length­Unit sub-element if that unit is the same than the unit of the Projected­CRS axes.
        • Parameter and Prime­Meridian elements omit the Angle­Unit sub-element if that unit is the same than the unit of the Geodetic­CRS axes.
        • Axes unit is declared only once after the axes instead of repeated for each axis if the unit is the same for all axes.
        • Angle­Unit, Length­Unit, Scale­Unit, Parametric­Unit and Time­Unit are formatted as plain Unit elements.
      • Id is formatted only for the root element (omit parameters and operation methods Id).
      Those modifications are allowed by the ISO 19162 standard, so the WKT is still valid.

      This is the default convention used by Formattable­Object​.to­String().

    • WKT1

      public static final Convention WKT1
      The OGC 01-009 format, also known as “WKT 1”. A definition for this format is shown in Extended Backus Naur Form (EBNF) on GeoAPI.

      Unless otherwise specified by WKTFormat​.set­Name­Authority(Citation), projections and parameters formatted with this convention will use the OGC names when available.

      Differences compared to WKT 2

      WKT 1 and WKT 2 differ in their keywords and syntax, but also in more subtle ways regarding axis names, parameter and code list values. For example in Geocentric­CRS, WKT 1 uses a legacy set of Cartesian axes which were defined in OGC 01-009. Those axes use the Other, Easting and Northing axis directions instead of the geocentric ones. For more uniform handling of CRS objects in client code, SIS parser replaces some WKT 1 conventions by the ISO ones when possible.
      Geocentric axis directions
      ISO 19111 OGC 01-009 Description
      Geocentric X Other Toward prime meridian
      Geocentric Y Easting Toward 90°E longitude
      Geocentric Z Northing Toward north pole
      Coordinate system axis names
      CRS type WKT1 names ISO abbreviations
      Geographic Lon, Lat λ, φ
      Vertical H H or h
      Projected X, Y E, N
      Geocentric X, Y, Z X, Y, Z
      See Also:

      public static final Convention WKT1_COMMON_UNITS
      The Simple Feature format, also known as “WKT 1”. Simple Feature is anterior to OGC 01-009 and defines the same format, but was unclear about the unit of measurement for prime meridians and projection parameters. Consequently many implementations interpreted those angular units as fixed to degrees instead than being context-dependent.

      This convention is identical to WKT1 except for the following aspects:

      • The angular units of PRIMEM and PARAMETER elements are always degrees, no matter the units of the enclosing GEOGCS element.
      • Unit names use American spelling instead of the international ones (e.g. "meter" instead of "metre").

      public static final Convention WKT1_IGNORE_AXES
      The Simple Feature format without parsing of axis elements. This convention is identical to WKT1_COMMON_UNITS except that all AXIS[…] elements are ignored. Since the WKT 1 specification said that the default axis order shall be (x,y) or (longitude, latitude), ignoring AXIS[…] elements is equivalent to forcing the coordinate systems to that default order.

      Note that AXIS[…] elements still need to be well formed even when parsing a text with this convention. Malformed axis elements will continue to cause a Parse­Exception despite their content being ignored.

      This convention may be useful for compatibility with some other software products that do not handle axis order correctly. But except when imposed by such compatibility reasons, this convention should be avoided as much as possible.


      @Debug public static final Convention INTERNAL
      A special convention for formatting objects as stored internally by Apache SIS. The result is similar to the one produced using the WKT2_SIMPLIFIED convention, with the following differences:
      • All quoted texts (not only the remarks) preserve non-ASCII characters.
      • Map projections are shown as SIS stores them internally, i.e. with the separation between linear and non-linear steps, rather than as a single operation.
      • Parameter elements omit the unit of measurement if that unit is equal to the default unit (as declared in the parameter descriptor).
      • Compound­CRS elements show nested compound CRS if any (the structure is not flattened).
      • Id elements are formatted for child elements in addition to the root one.
      • Id element omits the URI sub-element if the latter is derived by Apache SIS from the Id properties.
      • Remarks element is formatted for all identified objects, not only CRS or coordinate operations.
      • Additional attributes not defined by ISO 19162 may be formatted:
      This convention is used only for debugging purpose.
      See Also:
  • Method Details

    • values

      public static Convention[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static Convention valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      name - the name of the enum constant to be returned.
      the enum constant with the specified name
      Illegal­Argument­Exception - if this enum type has no constant with the specified name
      Null­Pointer­Exception - if the argument is null
    • majorVersion

      public int majorVersion()
      Returns the major version of the Well Known Text represented by this convention. In current Apache SIS implementation, this method can return only 1 or 2.
      1 if this convention is one of the WKT 1 variants, or 2 otherwise.
    • isSimplified

      public boolean isSimplified()
      Returns true if this convention is one of the simplified variants of WKT. The simplifications are documented in the WKT2_SIMPLIFIED javadoc.

      This methods consider version 1 of WKT as a “simplified” convention, since this version was indeed simpler than version 2.

      true it this convention uses a simplified variant of WKT.