Enum Class Convention
- All Implemented Interfaces:
Serializable,Comparable<Convention>,Constable
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, sometimes automatically. But some aspects cannot be guessed. One noticeable source of confusion is the unit of measurement ofPRIMEM[…] 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.
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.- Since:
- 0.4
- See Also:
Defined in the sis-referencing module
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum 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 Summary
Modifier and TypeMethodDescriptionbooleanReturnstrueif 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 class with the specified name.static Convention[]values()Returns an array containing the constants of this enum class, 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
-
WKT2
The ISO 19162 format, also known as “WKT 2”. This convention follows the ISO recommendations.Unless otherwise specified by
WKTFormat.setNameAuthority(Citation), projections and parameters formatted with this convention will use the EPSG names when available.This is the default convention used by
FormattableObject.toWKT()and for newWKTFormatinstances.- See Also:
-
WKT2_SIMPLIFIED
The ISO 19162 format with omission of some optional elements. This convention is identical to theWKT2convention except for the following aspects:- By default long keywords are used instead of short ones
(e.g.
"GeodeticCRS"instead of"GeodCRS") except for the"Unit"keyword, because they match the class or interface names. PrimeMeridianelement omitted if the meridian is Greenwich.Axiselement omits theOrdersub-element.Unitelements are less verbose:EllipsoidandVerticalExtentelements omit theLengthUnitsub-element if that unit isUnits.METRE.Parameterelements omit theLengthUnitsub-element if that unit is the same than the unit of theProjectedCRSaxes.ParameterandPrimeMeridianelements omit theAngleUnitsub-element if that unit is the same than the unit of theGeodeticCRSaxes.- Axes unit is declared only once after the axes instead of repeated for each axis if the unit is the same for all axes.
AngleUnit,LengthUnit,ScaleUnit,ParametricUnitandTimeUnitare formatted as plainUnitelements.
Idis formatted only for the root element (omit parameters and operation methodsId).
This is the default convention used by
FormattableObject.toString(). - By default long keywords are used instead of short ones
(e.g.
-
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.setNameAuthority(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, inGeocentricCRS, 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_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
WKT1except for the following aspects:- The angular units of
PRIMEMandPARAMETERelements are always degrees, no matter the units of the enclosingGEOGCSelement. - Unit names use American spelling instead of the international ones (e.g. "meter" instead of "metre").
- The angular units of
-
WKT1_IGNORE_AXES
The Simple Feature format without parsing of axis elements. This convention is identical toWKT1_COMMON_UNITSexcept that allAXIS[…]elements are ignored. Since the WKT 1 specification said that the default axis order shall be (x,y) or (longitude, latitude), ignoringAXIS[…]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 aParseExceptiondespite 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.
- Since:
- 0.6
-
INTERNAL
A special convention for formatting objects as stored internally by Apache SIS. The result is similar to the one produced using theWKT2_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 theURIsub-element if the latter is derived by Apache SIS from theIdproperties.Remarkselement is formatted for all identified objects, not only CRS or coordinate operations.- Additional attributes not defined by ISO 19162 may be formatted:
ImageDatumincludes the Pixel in Cell code.TemporalDatumincludes the Origin date.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- 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.- Returns:
- 1 if this convention is one of the WKT 1 variants, or 2 otherwise.
-
isSimplified
public boolean isSimplified()Returnstrueif this convention is one of the simplified variants of WKT. The simplifications are documented in theWKT2_SIMPLIFIEDjavadoc.This methods consider version 1 of WKT as a “simplified” convention, since this version was indeed simpler than version 2.
- Returns:
trueit this convention uses a simplified variant of WKT.
-