WKT 1 variantsThe 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
- 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.
WKT1_COMMON_UNITSenumeration allows parsing and formatting using the older interpretation. The
WKT1_IGNORE_AXESenumeration mimics the most minimalist WKT 1 parsers, but should be avoided when not imposed by compatibility reasons.
Nested Class Summary
Enum Constant SummaryEnum ConstantDescriptionA special convention for formatting objects as stored internally by Apache SIS.The OGC 01-009 format, also known as “WKT 1”.The Simple Feature format, also known as “WKT 1”.The Simple Feature format without parsing of axis elements.The ISO 19162 format, also known as “WKT 2”.The ISO 19162 format with omission of some optional elements.
Method SummaryModifier and TypeMethodDescription
trueif this convention is one of the simplified variants of WKT.
intReturns the major version of the Well Known Text represented by this convention.
static ConventionReturns the enum constant of this type with the specified name.
values()Returns an array containing the constants of this enum type, in the order they are declared.
Methods inherited from class Enum
clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
Enum Constant Details
WKT2public static final Convention WKT2The ISO 19162 format, also known as “WKT 2”. This convention follows the ISO recommendations.
- See Also:
WKT2_SIMPLIFIEDpublic static final Convention WKT2_SIMPLIFIEDThe ISO 19162 format with omission of some optional elements. This convention is identical to the
WKT2convention except for the following aspects:
- By default long keywords are used instead of short ones
"GeodCRS") except for the
"Unit"keyword, because they match the class or interface names.
PrimeMeridianelement omitted if the meridian is Greenwich.
Axiselement omits the
Unitelements are less verbose:
VerticalExtentelements omit the
LengthUnitsub-element if that unit is
Parameterelements omit the
LengthUnitsub-element if that unit is the same than the unit of the
PrimeMeridianelements omit the
AngleUnitsub-element if that unit is the same than the unit of the
- Axes unit is declared only once after the axes instead of repeated for each axis if the unit is the same for all axes.
TimeUnitare formatted as plain
Idis formatted only for the root element (omit parameters and operation methods
This is the default convention used by
- By default long keywords are used instead of short ones (e.g.
WKT1public static final Convention WKT1The OGC 01-009 format, also known as “WKT 1”. A definition for this format is shown in Extended Backus Naur Form (EBNF) on GeoAPI.
Differences compared to WKT 2WKT 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
GeocentricCRS, 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:
WKT1_COMMON_UNITSpublic static final Convention WKT1_COMMON_UNITSThe 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
WKT1except for the following aspects:
- The angular units of
PARAMETERelements are always degrees, no matter the units of the enclosing
- Unit names use American spelling instead of the international ones (e.g. "meter" instead of "metre").
- The angular units of
WKT1_IGNORE_AXESpublic static final Convention WKT1_IGNORE_AXESThe Simple Feature format without parsing of axis elements. This convention is identical to
WKT1_COMMON_UNITSexcept 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.
AXIS[…]elements still need to be well formed even when parsing a text with this convention. Malformed axis elements will continue to cause a
ParseExceptiondespite 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.
INTERNALA special convention for formatting objects as stored internally by Apache SIS. The result is similar to the one produced using the
WKT2_SIMPLIFIEDconvention, 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.
Parameterelements omit the unit of measurement if that unit is equal to the default unit (as declared in the parameter descriptor).
CompoundCRSelements show nested compound CRS if any (the structure is not flattened).
Idelements are formatted for child elements in addition to the root one.
Idelement omits the
URIsub-element if the latter is derived by Apache SIS from the
Remarkselement is formatted for all identified objects, not only CRS or coordinate operations.
- Additional attributes not defined by ISO 19162 may be formatted:
valuespublic 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
valueOfReturns 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.)
majorVersionpublic 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.
isSimplifiedpublic boolean isSimplified()Returns
trueif this convention is one of the simplified variants of WKT. The simplifications are documented in the
This methods consider version 1 of WKT as a “simplified” convention, since this version was indeed simpler than version 2.
trueit this convention uses a simplified variant of WKT.