Class GeodeticObjectParser
- All Implemented Interfaces:
Comparator<org.opengis.referencing.cs.CoordinateSystemAxis>
,Parser
- Direct Known Subclasses:
WKTFormat.Parser
"FITTED_CS"
element.- Since:
- 0.6
- Version:
- 1.3
-
Field Summary
FieldsModifier and TypeFieldDescriptionOrder of coordinate system axes.private final boolean
During WKT 1 parsing,true
means that axes should be parsed only for verifying the syntax, but otherwise parsing should behave as if axes were not declared.A map of properties to be given to the factory constructor methods.private static final String[]
The names of the 7 parameters in aTOWGS84[…]
element.private final Transliterator
The object to use for replacing WKT axis names and abbreviations by ISO 19111 names and abbreviations.private final boolean
During WKT 1 parsing,true
means thatPRIMEM
andPARAMETER
angular units need to be forced toUnits.DEGREE
instead of inferred from the context.private org.opengis.referencing.crs.VerticalCRS
The last vertical CRS found during the parsing, ornull
if none.private VerticalInfo
A chained list of temporary information needed for completing the construction ofDefaultVerticalExtent
instances.Fields inherited from class org.apache.sis.io.wkt.MathTransformParser
factories, ID_KEYWORDS
Fields inherited from class org.apache.sis.io.wkt.AbstractParser
errorLocale, FIRST, fragments, ignoredElements, MANDATORY, OPTIONAL, symbols
-
Constructor Summary
ConstructorsConstructorDescriptionGeodeticObjectParser
(Map<String, ?> defaultProperties, org.opengis.referencing.ObjectFactory factories, org.opengis.referencing.operation.MathTransformFactory mtFactory) Constructs a parser for the specified set of symbols using the specified set of factories.GeodeticObjectParser
(Symbols symbols, Map<String, StoredTree> fragments, NumberFormat numberFormat, DateFormat dateFormat, UnitFormat unitFormat, Convention convention, Transliterator transliterator, Locale errorLocale, ReferencingFactoryContainer factories) Constructs a parser for the specified set of symbols using the specified set of factories. -
Method Summary
Modifier and TypeMethodDescription(package private) final Object
buildFromTree
(Element element) Parses the next element in the specified Well Know Text (WKT) tree.final int
compare
(org.opengis.referencing.cs.CoordinateSystemAxis o1, org.opengis.referencing.cs.CoordinateSystemAxis o2) Compares axes for order.(package private) void
completeRoot
(Map<String, Object> properties) Completes or edits properties of the rootIdentifiedObject
.(package private) final Object
createFromWKT
(String text, ParsePosition position) Parses a Well-Know Text from specified position as a geodetic object.Returns the factory to use for creating coordinate operation.(package private) String
Returns the name of the class providing the publicly-accessiblecreateFromWKT(String)
method.parseAnchorAndClose
(Element element, String name) Parses the datumANCHOR[]
element and pass the values to theparseMetadataAndClose(Element, String, IdentifiedObject)
method.private org.opengis.referencing.cs.CoordinateSystemAxis
Parses an"AXIS"
element.private org.opengis.referencing.crs.SingleCRS
parseBaseCRS
(int mode, Element parent, org.opengis.referencing.operation.OperationMethod method) Parses a"GeodeticCRS"
(WKT 2) element where the number of dimensions and coordinate system type are derived from the operation method.private org.opengis.referencing.crs.CoordinateReferenceSystem
parseCompoundCRS
(int mode, Element parent) Parses a"CompoundCRS"
element.private org.opengis.referencing.crs.CoordinateReferenceSystem
parseCoordinateReferenceSystem
(Element element, boolean mandatory) Parses a coordinate reference system element.private org.opengis.referencing.crs.CoordinateReferenceSystem
parseCoordinateReferenceSystem
(Element parent, int mode, String keyword) Parses a coordinate reference system wrapped in an element of the given name.private org.opengis.referencing.cs.CoordinateSystem
parseCoordinateSystem
(Element parent, String type, int dimension, boolean isWKT1, javax.measure.Unit<?> defaultUnit, org.opengis.referencing.datum.Datum datum) Parses a"CS"
element followed by all"AXIS"
elements.private org.opengis.referencing.datum.GeodeticDatum
parseDatum
(int mode, Element parent, org.opengis.referencing.datum.PrimeMeridian meridian) Parses a"Datum"
(WKT 2) element.private org.opengis.referencing.operation.Conversion
parseDerivingConversion
(int mode, Element parent, String wrapper, javax.measure.Unit<?> defaultUnit, javax.measure.Unit<javax.measure.quantity.Angle> defaultAngularUnit) Parses a"Method"
(WKT 2) element, followed by parameter values.private org.opengis.referencing.datum.Ellipsoid
parseEllipsoid
(int mode, Element parent) Parses an"Ellipsoid"
element.private org.opengis.referencing.crs.SingleCRS
parseEngineeringCRS
(int mode, Element parent, boolean isBaseCRS) Parses a"EngineeringCRS"
(WKT 2) element.private org.opengis.referencing.datum.EngineeringDatum
parseEngineeringDatum
(int mode, Element parent, boolean isWKT1) Parses a"EngineeringDatum"
(WKT 2) element.private org.opengis.referencing.crs.DerivedCRS
parseFittedCS
(int mode, Element parent) Parses a"FITTED_CS"
element.private org.opengis.referencing.crs.SingleCRS
parseGeodeticCRS
(int mode, Element parent, int dimension, String csType) Parses a"GeodeticCRS"
(WKT 2) element.private org.opengis.referencing.operation.CoordinateOperation
parseGeogTranslation
(int mode, Element parent) Parses a"GeogTran"
element.private org.opengis.referencing.crs.ImageCRS
parseImageCRS
(int mode, Element parent) Parses an"ImageCRS"
(WKT 2) element.private org.opengis.referencing.datum.ImageDatum
parseImageDatum
(int mode, Element parent) Parses an"ImageDatum"
(WKT 2) element.parseMetadataAndClose
(Element parent, String name, org.opengis.referencing.IdentifiedObject fallback) Parses an optional metadata elements and close.private org.opengis.referencing.operation.OperationMethod
parseMethod
(Element parent, String... keywords) Parses a"Method"
(WKT 2) element, without the parameters.private org.opengis.referencing.operation.CoordinateOperation
parseOperation
(int mode, Element parent) Parses a"CoordinateOperation"
element.parseParametersAndClose
(Element parent, String name, org.opengis.referencing.operation.OperationMethod method) Parses a sequence of"PARAMETER"
elements, then parses optional metadata elements and close.private org.opengis.referencing.crs.SingleCRS
parseParametricCRS
(int mode, Element parent, boolean isBaseCRS) Parses"ParametricCRS"
element.private org.opengis.referencing.datum.Datum
parseParametricDatum
(int mode, Element parent) Parses a"ParametricDatum"
element.private org.opengis.referencing.datum.PrimeMeridian
parsePrimeMeridian
(int mode, Element parent, boolean isWKT1, javax.measure.Unit<javax.measure.quantity.Angle> angularUnit) Parses a"PrimeMeridian"
element.private org.opengis.referencing.crs.ProjectedCRS
parseProjectedCRS
(int mode, Element parent, boolean isBaseCRS) Parses a"ProjectedCRS"
(WKT 2) element.private <Q extends javax.measure.Quantity<Q>>
javax.measure.Unit<Q>parseScaledUnit
(Element parent, String keyword, javax.measure.Unit<Q> baseUnit) Parses an optional"UNIT"
element of a known dimension.private org.opengis.referencing.crs.SingleCRS
parseTimeCRS
(int mode, Element parent, boolean isBaseCRS) Parses"TimeCRS"
element.private org.opengis.referencing.datum.TemporalDatum
parseTimeDatum
(int mode, Element parent) Parses a"TimeDatum"
element.private Object
parseToWGS84
(int mode, Element parent) Parses an optional"TOWGS84"
element.private org.opengis.referencing.crs.SingleCRS
parseVerticalCRS
(int mode, Element parent, boolean isBaseCRS) Parses a"VerticalCRS"
(WKT 2) element.private org.opengis.referencing.datum.VerticalDatum
parseVerticalDatum
(int mode, Element parent, boolean isWKT1) Parses a"VerticalDatum"
(WKT 2) element.private static org.opengis.metadata.Identifier
toIdentifier
(Object identifier) Returns the value associated toIdentifiedObject.IDENTIFIERS_KEY
as anIdentifier
object.Methods inherited from class org.apache.sis.io.wkt.MathTransformParser
completeUnitFactor, getOperationMethod, parseMathTransform, parseParameters, parseUnit, parseUnitID
Methods inherited from class org.apache.sis.io.wkt.AbstractParser
createFromWKT, endOfFragmentName, getAndClearWarnings, getFacadeMethod, log, parseDate, parseNumber, parseUnit, textToTree, warning, warning
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
ToWGS84
The names of the 7 parameters in aTOWGS84[…]
element. Those names are derived from the Well Known Text (WKT) version 1 specification. They are not the same than theBursaWolfParameters
field names, which are derived from the EPSG database. -
usesCommonUnits
private final boolean usesCommonUnitsDuring WKT 1 parsing,true
means thatPRIMEM
andPARAMETER
angular units need to be forced toUnits.DEGREE
instead of inferred from the context. Note that this rule does not apply toAXIS
elementsThis flag is ignored during WKT 2 parsing.
- See Also:
-
ignoreAxes
private final boolean ignoreAxesDuring WKT 1 parsing,true
means that axes should be parsed only for verifying the syntax, but otherwise parsing should behave as if axes were not declared.This flag is ignored during WKT 2 parsing.
- See Also:
-
transliterator
The object to use for replacing WKT axis names and abbreviations by ISO 19111 names and abbreviations. -
properties
A map of properties to be given to the factory constructor methods. This map will be recycled for each object to be parsed. -
axisOrder
Order of coordinate system axes. Used only ifAXIS[…]
elements containORDER[…]
sub-element. -
verticalCRS
private transient org.opengis.referencing.crs.VerticalCRS verticalCRSThe last vertical CRS found during the parsing, ornull
if none. This information is needed for creatingDefaultVerticalExtent
instances.ISO 19162 said that we should have at most one vertical CRS per WKT. Apache SIS does not enforce this constraint, but if a WKT contains more than one vertical CRS then the instance used for completing the
DefaultVerticalExtent
instances is unspecified. -
verticalElements
A chained list of temporary information needed for completing the construction ofDefaultVerticalExtent
instances. In particular, stores the unit of measurement until theVerticalCRS
instance to associate to the extents become known.
-
-
Constructor Details
-
GeodeticObjectParser
public GeodeticObjectParser(Map<String, ?> defaultProperties, org.opengis.referencing.ObjectFactory factories, org.opengis.referencing.operation.MathTransformFactory mtFactory) Constructs a parser for the specified set of symbols using the specified set of factories. This constructor is for internal usage by Apache SIS only — do not use!Maintenance note: this constructor is invoked through reflection by
GeodeticObjectFactory.createFromWKT(String)
. Do not change the method signature even if it doesn't break the compilation, unless the reflection code is also updated.- Parameters:
defaultProperties
- default properties to give to the objects to create.factories
- an object implementingDatumFactory
,CSFactory
andCRSFactory
.mtFactory
- the factory to use to createMathTransform
objects.
-
GeodeticObjectParser
GeodeticObjectParser(Symbols symbols, Map<String, StoredTree> fragments, NumberFormat numberFormat, DateFormat dateFormat, UnitFormat unitFormat, Convention convention, Transliterator transliterator, Locale errorLocale, ReferencingFactoryContainer factories) Constructs a parser for the specified set of symbols using the specified set of factories. This constructor is forWKTFormat
usage only.- Parameters:
symbols
- the set of symbols to use.fragments
- reference to theWKTFormat.fragments
map, or an empty map if none.numberFormat
- the number format provided byWKTFormat
, ornull
for a default format.dateFormat
- the date format provided byWKTFormat
, ornull
for a default format.unitFormat
- the unit format provided byWKTFormat
, ornull
for a default format.convention
- the WKT convention to use.errorLocale
- the locale for error messages (not for parsing), ornull
for the system default.factories
- on input, the factories to use. On output, the factories used. Can be null.
-
-
Method Details
-
getPublicFacade
String getPublicFacade()Returns the name of the class providing the publicly-accessiblecreateFromWKT(String)
method. This information is used for logging purpose only.- Overrides:
getPublicFacade
in classMathTransformParser
-
completeRoot
Completes or edits properties of the rootIdentifiedObject
. This method is invoked before aFactory.createFoo(Map, …)
method is invoked for creating the root object. Theproperties
map is filled with all information that this parser found in the WKT elements. Subclasses can override this method for adding additional information if desired.The most typical use case is to add a default
Identifier
when the WKT does not contain an explicitID[…]
orAUTHORITY[…]
element.- Parameters:
properties
- the properties to be given in a call to acreateFoo(Map, …)
method.- See Also:
-
createFromWKT
Parses a Well-Know Text from specified position as a geodetic object. Caller should invokeAbstractParser.getAndClearWarnings(Object)
in afinally
block after this method.- Overrides:
createFromWKT
in classAbstractParser
- Parameters:
text
- the Well-Known Text (WKT) to parse.position
- index of the first character to parse (on input) or after last parsed character (on output).- Returns:
- the parsed object.
- Throws:
ParseException
- if the string cannot be parsed.
-
buildFromTree
Parses the next element in the specified Well Know Text (WKT) tree.- Overrides:
buildFromTree
in classMathTransformParser
- Parameters:
element
- the element to be parsed.- Returns:
- the parsed object.
- Throws:
ParseException
- if the element cannot be parsed.
-
parseCoordinateReferenceSystem
private org.opengis.referencing.crs.CoordinateReferenceSystem parseCoordinateReferenceSystem(Element element, boolean mandatory) throws ParseException Parses a coordinate reference system element.- Parameters:
element
- the parent element.mandatory
-true
if a CRS must be present, orfalse
if optional.- Returns:
- the next element as a
CoordinateReferenceSystem
object. - Throws:
ParseException
- if the next element cannot be parsed.
-
parseCoordinateReferenceSystem
private org.opengis.referencing.crs.CoordinateReferenceSystem parseCoordinateReferenceSystem(Element parent, int mode, String keyword) throws ParseException Parses a coordinate reference system wrapped in an element of the given name.- Parameters:
parent
- the parent element containing the CRS to parse.mode
-AbstractParser.FIRST
,AbstractParser.OPTIONAL
orAbstractParser.MANDATORY
.keyword
- "SourceCRS", "TargetCRS" or "InterpolationCRS".- Returns:
- the coordinate reference system, or
null
if none. - Throws:
ParseException
- if the CRS cannot be parsed.
-
toIdentifier
Returns the value associated toIdentifiedObject.IDENTIFIERS_KEY
as anIdentifier
object. This method shall accept all value types thatparseMetadataAndClose(Element, String, IdentifiedObject)
may store.- Parameters:
identifier
- theproperties
value, ornull
.- Returns:
- the identifier, or
null
if the given value was null.
-
parseMetadataAndClose
private Map<String,Object> parseMetadataAndClose(Element parent, String name, org.opengis.referencing.IdentifiedObject fallback) throws ParseException Parses an optional metadata elements and close. This includes elements like"SCOPE"
,"ID"
(WKT 2) or"AUTHORITY"
(WKT 1). This WKT 1 element has the following pattern:Fallback
The name is a mandatory property, but some invalid WKT with an empty string exist. In such case, we will use the name of the enclosed datum. Indeed, it is not uncommon to have the same name for a geographic CRS and its geodetic datum.- Parameters:
parent
- the parent element.name
- the name of the parent object being parsed.fallback
- the fallback to use ifname
is empty.- Returns:
- a properties map with the parent name and the optional authority code.
- Throws:
ParseException
- if an element cannot be parsed.- See Also:
-
parseAnchorAndClose
Parses the datumANCHOR[]
element and pass the values to theparseMetadataAndClose(Element, String, IdentifiedObject)
method. If an anchor has been found, its value is stored in the returned map.- Throws:
ParseException
-
parseScaledUnit
private <Q extends javax.measure.Quantity<Q>> javax.measure.Unit<Q> parseScaledUnit(Element parent, String keyword, javax.measure.Unit<Q> baseUnit) throws ParseException Parses an optional"UNIT"
element of a known dimension. This element has the following pattern: Unit was a mandatory element in WKT 1, but became optional in WKT 2 because the unit may be specified in eachAXIS[…]
element instead of for the whole coordinate system.- Parameters:
parent
- the parent element.keyword
- the unit keyword (e.g."LengthUnit"
or"AngleUnit"
).baseUnit
- the base unit, usuallyUnits.METRE
orUnits.RADIAN
.- Returns:
- the
"UNIT"
element as anUnit
object, ornull
if none. - Throws:
ParseException
- if the"UNIT"
cannot be parsed.- See Also:
-
parseCoordinateSystem
private org.opengis.referencing.cs.CoordinateSystem parseCoordinateSystem(Element parent, String type, int dimension, boolean isWKT1, javax.measure.Unit<?> defaultUnit, org.opengis.referencing.datum.Datum datum) throws ParseException, org.opengis.util.FactoryException Parses a"CS"
element followed by all"AXIS"
elements. This element has the following pattern (simplified): This element is different from all other elements parsed byGeodeticObjectParser
in that its components are sibling elements rather than child elements of the CS element.The optional
"UNIT[…]"
element shall be parsed by the caller. That element may appear after the"CS[…]"
element (not inside). The unit may be forced to some dimension (e.g."LengthUnit"
) or be any kind of unit, depending on the context in which thisparseCoordinateSystem(…)
method is invoked.Variants of Cartesian type
TheWKTKeywords.Cartesian
type may be used for projected, geocentric or other kinds of CRS. However, while all those variants are of the same CS type, their axis names and directions differ. Current implementation uses the following rules:- If the datum is not geodetic, then the axes of the Cartesian CS are unknown.
- Otherwise if
dimension is 2
, then the CS is assumed to be for a projected CRS. - Otherwise if
dimension is 3
, then the CS is assumed to be for a geocentric CRS.
- Parameters:
parent
- the parent element.type
- the expected type (Cartesian | ellipsoidal | vertical | etc…), or null if unknown.dimension
- the minimal number of dimensions. Can be 1 if unknown.isWKT1
-true
if the parent element is an element from the WKT 1 standard.defaultUnit
- the contextual unit (usuallyUnits.METRE
orUnits.RADIAN
), ornull
if unknown.datum
- the datum of the enclosing CRS, ornull
if unknown.- Returns:
- the
"CS"
,"UNIT"
and/or"AXIS"
elements as a Coordinate System, ornull
. - Throws:
ParseException
- if an element cannot be parsed.org.opengis.util.FactoryException
- if the factory cannot create the coordinate system.
-
parseAxis
private org.opengis.referencing.cs.CoordinateSystemAxis parseAxis(int mode, Element parent, String csType, javax.measure.Unit<?> defaultUnit) throws ParseException Parses an"AXIS"
element. This element has the following pattern (simplified): Abbreviation may be specified between parenthesis. Nested parenthesis are possible, as for example:- Parameters:
mode
-AbstractParser.FIRST
,AbstractParser.OPTIONAL
orAbstractParser.MANDATORY
.parent
- the parent element.csType
- the coordinate system type (Cartesian | ellipsoidal | vertical | etc…), or null if unknown.defaultUnit
- the contextual unit (usuallyUnits.METRE
orUnits.RADIAN
), ornull
if unknown.- Returns:
- the
"AXIS"
element as aCoordinateSystemAxis
object, ornull
if the axis was not required and there are no axis objects. - Throws:
ParseException
- if the"AXIS"
element cannot be parsed.
-
compare
public final int compare(org.opengis.referencing.cs.CoordinateSystemAxis o1, org.opengis.referencing.cs.CoordinateSystemAxis o2) Compares axes for order. This method is used for ordering axes according theirORDER
element, if present. If noORDER
element were present, then the axis order is left unchanged. If only some axes have anORDER
element (which is illegal according ISO 19162), then those axes will be sorted before the axes withoutORDER
element.- Specified by:
compare
in interfaceComparator<org.opengis.referencing.cs.CoordinateSystemAxis>
- Parameters:
o1
- the first axis to compare.o2
- the second axis to compare.- Returns:
- -1 if
o1
should be beforeo2
, +1 ifo2
should be beforeo1
, or 0 if undetermined (no axis order change).
-
parsePrimeMeridian
private org.opengis.referencing.datum.PrimeMeridian parsePrimeMeridian(int mode, Element parent, boolean isWKT1, javax.measure.Unit<javax.measure.quantity.Angle> angularUnit) throws ParseException Parses a"PrimeMeridian"
element. The syntax is given by WKT 2 specification §8.2.2. The legacy WKT 1 pattern was:- Parameters:
mode
-AbstractParser.FIRST
,AbstractParser.OPTIONAL
orAbstractParser.MANDATORY
.parent
- the parent element.isWKT1
-true
if this method is invoked while parsing a WKT 1 element.angularUnit
- the contextual unit.- Returns:
- the
"PrimeMeridian"
element as aPrimeMeridian
object. - Throws:
ParseException
- if the"PrimeMeridian"
element cannot be parsed.- See Also:
-
parseToWGS84
Parses an optional"TOWGS84"
element. This element is specific to WKT 1 and has the following pattern:- Parameters:
mode
-AbstractParser.FIRST
,AbstractParser.OPTIONAL
orAbstractParser.MANDATORY
.parent
- the parent element.- Returns:
- the
"TOWGS84"
element as aBursaWolfParameters
object, ornull
if no"TOWGS84"
has been found. - Throws:
ParseException
- if the"TOWGS84"
cannot be parsed.
-
parseEllipsoid
private org.opengis.referencing.datum.Ellipsoid parseEllipsoid(int mode, Element parent) throws ParseException Parses an"Ellipsoid"
element. The syntax is given by WKT 2 specification §8.2.1. The legacy WKT 1 pattern was:- Parameters:
mode
-AbstractParser.FIRST
,AbstractParser.OPTIONAL
orAbstractParser.MANDATORY
.parent
- the parent element.- Returns:
- the
"Ellipsoid"
element as anEllipsoid
object. - Throws:
ParseException
- if the"Ellipsoid"
element cannot be parsed.- See Also:
-
parseBaseCRS
private org.opengis.referencing.crs.SingleCRS parseBaseCRS(int mode, Element parent, org.opengis.referencing.operation.OperationMethod method) throws ParseException Parses a"GeodeticCRS"
(WKT 2) element where the number of dimensions and coordinate system type are derived from the operation method. This is used for parsing the base CRS component of derived CRS.- Parameters:
mode
-AbstractParser.OPTIONAL
orAbstractParser.MANDATORY
.parent
- the parent element.method
- the operation method, ornull
if unknown.- Throws:
ParseException
- if the"GeodeticCRS"
element cannot be parsed.
-
parseMethod
private org.opengis.referencing.operation.OperationMethod parseMethod(Element parent, String... keywords) throws ParseException Parses a"Method"
(WKT 2) element, without the parameters.- Parameters:
parent
- the parent element.keywords
- the element keywords.- Returns:
- the operation method.
- Throws:
ParseException
- if the"Method"
element cannot be parsed.
-
parseDerivingConversion
private org.opengis.referencing.operation.Conversion parseDerivingConversion(int mode, Element parent, String wrapper, javax.measure.Unit<?> defaultUnit, javax.measure.Unit<javax.measure.quantity.Angle> defaultAngularUnit) throws ParseException Parses a"Method"
(WKT 2) element, followed by parameter values. The syntax is given by WKT 2 specification §9.3. The legacy WKT 1 specification was: Note that in WKT 2, this element is wrapped inside aConversion
orDerivingConversion
element which is itself inside theProjectedCRS
element. This is different than WKT 1, which puts this element right into the theProjectedCRS
element withoutConversion
wrapper.- Parameters:
mode
-AbstractParser.FIRST
,AbstractParser.OPTIONAL
orAbstractParser.MANDATORY
.parent
- the parent element.wrapper
- "Conversion" or "DerivingConversion" wrapper name, or null if parsing a WKT 1.defaultUnit
- the unit (usually linear) of the parent element, ornull
.defaultAngularUnit
- the angular unit of the siblingGeographicCRS
element, ornull
.- Returns:
- the
"Method"
element and its parameters as a defining conversion. - Throws:
ParseException
- if the"Method"
element cannot be parsed.
-
parseDatum
private org.opengis.referencing.datum.GeodeticDatum parseDatum(int mode, Element parent, org.opengis.referencing.datum.PrimeMeridian meridian) throws ParseException Parses a"Datum"
(WKT 2) element. The syntax is given by WKT 2 specification §8.2.4. The legacy WKT 1 pattern was:- Parameters:
mode
-AbstractParser.FIRST
,AbstractParser.OPTIONAL
orAbstractParser.MANDATORY
.parent
- the parent element.meridian
- the prime meridian, ornull
for Greenwich.- Returns:
- the
"Datum"
element as aGeodeticDatum
object. - Throws:
ParseException
- if the"Datum"
element cannot be parsed.- See Also:
-
parseVerticalDatum
private org.opengis.referencing.datum.VerticalDatum parseVerticalDatum(int mode, Element parent, boolean isWKT1) throws ParseException Parses a"VerticalDatum"
(WKT 2) element. The syntax is given by WKT 2 specification §10.2. The legacy WKT 1 pattern was:- Parameters:
mode
-AbstractParser.FIRST
,AbstractParser.OPTIONAL
orAbstractParser.MANDATORY
.parent
- the parent element.isWKT1
-true
if the parent is a WKT 1 element.- Returns:
- the
"VerticalDatum"
element as aVerticalDatum
object. - Throws:
ParseException
- if the"VerticalDatum"
element cannot be parsed.
-
parseTimeDatum
private org.opengis.referencing.datum.TemporalDatum parseTimeDatum(int mode, Element parent) throws ParseException Parses a"TimeDatum"
element. This element has the following pattern:- Parameters:
mode
-AbstractParser.FIRST
,AbstractParser.OPTIONAL
orAbstractParser.MANDATORY
.parent
- the parent element.- Returns:
- the
"TimeDatum"
element as aTemporalDatum
object. - Throws:
ParseException
- if the"TimeDatum"
element cannot be parsed.
-
parseParametricDatum
private org.opengis.referencing.datum.Datum parseParametricDatum(int mode, Element parent) throws ParseException Parses a"ParametricDatum"
element. This element has the following pattern:- Parameters:
mode
-AbstractParser.FIRST
,AbstractParser.OPTIONAL
orAbstractParser.MANDATORY
.parent
- the parent element.- Returns:
- the
"ParametricDatum"
element as aParametricDatum
object. - Throws:
ParseException
- if the"ParametricDatum"
element cannot be parsed.
-
parseEngineeringDatum
private org.opengis.referencing.datum.EngineeringDatum parseEngineeringDatum(int mode, Element parent, boolean isWKT1) throws ParseException Parses a"EngineeringDatum"
(WKT 2) element. The syntax is given by WKT 2 specification §11.2. The legacy WKT 1 pattern was: The datum type (WKT 1 only) is currently ignored.- Parameters:
mode
-AbstractParser.FIRST
,AbstractParser.OPTIONAL
orAbstractParser.MANDATORY
.parent
- the parent element.isWKT1
-true
if the parent is a WKT 1 element.- Returns:
- the
"EngineeringDatum"
element as anEngineeringDatum
object. - Throws:
ParseException
- if the"EngineeringDatum"
element cannot be parsed.
-
parseImageDatum
private org.opengis.referencing.datum.ImageDatum parseImageDatum(int mode, Element parent) throws ParseException Parses an"ImageDatum"
(WKT 2) element. The syntax is given by WKT 2 specification §12.2.- Parameters:
mode
-AbstractParser.FIRST
,AbstractParser.OPTIONAL
orAbstractParser.MANDATORY
.parent
- the parent element.- Returns:
- the
"ImageDatum"
element as anImageDatum
object. - Throws:
ParseException
- if the"ImageDatum"
element cannot be parsed.
-
parseEngineeringCRS
private org.opengis.referencing.crs.SingleCRS parseEngineeringCRS(int mode, Element parent, boolean isBaseCRS) throws ParseException Parses a"EngineeringCRS"
(WKT 2) element. The syntax is given by WKT 2 specification §11. The legacy WKT 1 pattern was:- Parameters:
mode
-AbstractParser.FIRST
,AbstractParser.OPTIONAL
orAbstractParser.MANDATORY
.parent
- the parent element.isBaseCRS
-true
if parsing the CRS inside aDerivedCRS
.- Returns:
- the
"EngineeringCRS"
element as anEngineeringCRS
object. - Throws:
ParseException
- if the"EngineeringCRS"
element cannot be parsed.
-
parseImageCRS
private org.opengis.referencing.crs.ImageCRS parseImageCRS(int mode, Element parent) throws ParseException Parses an"ImageCRS"
(WKT 2) element. The syntax is given by WKT 2 specification §12.- Parameters:
mode
-AbstractParser.FIRST
,AbstractParser.OPTIONAL
orAbstractParser.MANDATORY
.parent
- the parent element.- Returns:
- the
"ImageCRS"
element as anImageCRS
object. - Throws:
ParseException
- if the"ImageCRS"
element cannot be parsed.
-
parseGeodeticCRS
private org.opengis.referencing.crs.SingleCRS parseGeodeticCRS(int mode, Element parent, int dimension, String csType) throws ParseException Parses a"GeodeticCRS"
(WKT 2) element. The syntax is given by WKT 2 specification §8. The legacy WKT 1 specification had two elements for this: and- Parameters:
mode
-AbstractParser.FIRST
,AbstractParser.OPTIONAL
orAbstractParser.MANDATORY
.parent
- the parent element.dimension
- the minimal number of dimensions (usually 2).csType
- the default coordinate system type, ornull
if unknown. Should be non-null only when parsing aGeneralDerivedCRS.getBaseCRS()
component.- Returns:
- the
"GeodeticCRS"
element as aGeographicCRS
orGeocentricCRS
object. - Throws:
ParseException
- if the"GeodeticCRS"
element cannot be parsed.- See Also:
-
parseVerticalCRS
private org.opengis.referencing.crs.SingleCRS parseVerticalCRS(int mode, Element parent, boolean isBaseCRS) throws ParseException Parses a"VerticalCRS"
(WKT 2) element. The syntax is given by WKT 2 specification §10. The legacy WKT 1 pattern was:- Parameters:
mode
-AbstractParser.FIRST
,AbstractParser.OPTIONAL
orAbstractParser.MANDATORY
.parent
- the parent element.isBaseCRS
-true
if parsing the CRS inside aDerivedCRS
.- Returns:
- the
"VerticalCRS"
element as aVerticalCRS
object. - Throws:
ParseException
- if the"VerticalCRS"
element cannot be parsed.
-
parseTimeCRS
private org.opengis.referencing.crs.SingleCRS parseTimeCRS(int mode, Element parent, boolean isBaseCRS) throws ParseException Parses"TimeCRS"
element.- Parameters:
mode
-AbstractParser.FIRST
,AbstractParser.OPTIONAL
orAbstractParser.MANDATORY
.parent
- the parent element.isBaseCRS
-true
if parsing the CRS inside aDerivedCRS
.- Returns:
- the
"TimeCRS"
element as aTemporalCRS
object. - Throws:
ParseException
- if the"TimeCRS"
element cannot be parsed.
-
parseParametricCRS
private org.opengis.referencing.crs.SingleCRS parseParametricCRS(int mode, Element parent, boolean isBaseCRS) throws ParseException Parses"ParametricCRS"
element.- Parameters:
mode
-AbstractParser.FIRST
,AbstractParser.OPTIONAL
orAbstractParser.MANDATORY
.parent
- the parent element.isBaseCRS
-true
if parsing the CRS inside aDerivedCRS
.- Returns:
- the
"ParametricCRS"
object. - Throws:
ParseException
- if the"ParametricCRS"
element cannot be parsed.
-
parseProjectedCRS
private org.opengis.referencing.crs.ProjectedCRS parseProjectedCRS(int mode, Element parent, boolean isBaseCRS) throws ParseException Parses a"ProjectedCRS"
(WKT 2) element. The syntax is given by WKT 2 specification §9. The legacy WKT 1 specification was:- Parameters:
mode
-AbstractParser.FIRST
,AbstractParser.OPTIONAL
orAbstractParser.MANDATORY
.parent
- the parent element.isBaseCRS
-true
if parsing the CRS inside aDerivedCRS
.- Returns:
- the
"ProjectedCRS"
element as aProjectedCRS
object. - Throws:
ParseException
- if the"ProjectedCRS"
element cannot be parsed.
-
parseCompoundCRS
private org.opengis.referencing.crs.CoordinateReferenceSystem parseCompoundCRS(int mode, Element parent) throws ParseException Parses a"CompoundCRS"
element. The syntax is given by WKT 2 specification §16. The legacy WKT 1 specification was: In the particular case where there is a geographic CRS and an ellipsoidal height, this method rather build a three-dimensional geographic CRS.- Parameters:
mode
-AbstractParser.FIRST
,AbstractParser.OPTIONAL
orAbstractParser.MANDATORY
.parent
- the parent element.- Returns:
- the
"CompoundCRS"
element as aCompoundCRS
object. - Throws:
ParseException
- if the"CompoundCRS"
element cannot be parsed.
-
parseFittedCS
private org.opengis.referencing.crs.DerivedCRS parseFittedCS(int mode, Element parent) throws ParseException Parses a"FITTED_CS"
element. This element has the following pattern:- Parameters:
mode
-AbstractParser.FIRST
,AbstractParser.OPTIONAL
orAbstractParser.MANDATORY
.parent
- the parent element.- Returns:
- the
"FITTED_CS"
element as aCompoundCRS
object. - Throws:
ParseException
- if the"COMPD_CS"
element cannot be parsed.
-
parseGeogTranslation
private org.opengis.referencing.operation.CoordinateOperation parseGeogTranslation(int mode, Element parent) throws ParseException Parses a"GeogTran"
element. This is specific to ESRI.- Parameters:
mode
-AbstractParser.FIRST
,AbstractParser.OPTIONAL
orAbstractParser.MANDATORY
.parent
- the parent element.- Returns:
- the
"GeogTran"
element as aCoordinateOperation
object. - Throws:
ParseException
- if the"GeogTran"
element cannot be parsed.
-
parseOperation
private org.opengis.referencing.operation.CoordinateOperation parseOperation(int mode, Element parent) throws ParseException Parses a"CoordinateOperation"
element. The syntax is given by WKT 2 specification §17.- Parameters:
mode
-AbstractParser.FIRST
,AbstractParser.OPTIONAL
orAbstractParser.MANDATORY
.parent
- the parent element.- Returns:
- the
"CoordinateOperation"
element as aCoordinateOperation
object. - Throws:
ParseException
- if the"CoordinateOperation"
element cannot be parsed.
-
parseParametersAndClose
private Map<String,Object> parseParametersAndClose(Element parent, String name, org.opengis.referencing.operation.OperationMethod method) throws ParseException Parses a sequence of"PARAMETER"
elements, then parses optional metadata elements and close.- Parameters:
parent
- the parent element.name
- the name of the parent object being parsed.method
- the operation method, also the fallback to use ifname
is empty.- Returns:
- a properties map with the parent name, the optional authority code and the parameters.
- Throws:
ParseException
- if an element cannot be parsed.- See Also:
-
getOperationFactory
Returns the factory to use for creating coordinate operation.
-