Class DefaultMathTransformFactory
- All Implemented Interfaces:
Parser
,org.opengis.referencing.operation.MathTransformFactory
,org.opengis.util.Factory
- Direct Known Subclasses:
DefaultMathTransformFactory.NoCache
CRS
or MathTransforms
classes instead.
Standard parameters
MathTransform
instances are created from parameter values.
The parameters expected by each operation available in a default Apache SIS installation is
listed here.
The set of parameters varies for each operation or projection, but the following can be considered typical:
- A semi-major and semi-minor axis length in metres.
- A central meridian and latitude of origin in decimal degrees.
- A scale factor, which default to 1.
- A false easting and false northing in metres, which default to 0.
Each descriptor has many aliases, and those aliases may vary between different projections.
For example, the false easting parameter is usually called "false_easting"
by OGC, while EPSG uses various names like "False easting" or "Easting at
false origin".
Dynamic parameters
A few non-standard parameters are defined for compatibility reasons, but delegates their work to standard parameters. Those dynamic parameters are not listed in the parameter values. Dynamic parameters are:"earth_radius"
, which copy its value to the"semi_major"
and"semi_minor"
parameter values."inverse_flattening"
, which compute the"semi_minor"
value from the"semi_major"
parameter value."standard_parallel"
expecting an array of typedouble[]
, which copy its elements to the"standard_parallel_1"
and"standard_parallel_2"
parameter scalar values.
The main purpose of those dynamic parameters is to support some less commonly used conventions without duplicating the most commonly used conventions. The alternative ways are used in netCDF files for example, which often use spherical models instead of ellipsoidal ones.
Mandatory and optional parameters
Parameters are flagged as either mandatory or optional. A parameter may be mandatory and still have a default value. In the context of this package, "mandatory" means that the parameter is an essential part of the projection defined by standards. Such mandatory parameters will always appears in any Well Known Text (WKT) formatting, even if not explicitly set by the user. For example, the central meridian is typically a mandatory parameter with a default value of 0° (the Greenwich meridian).Optional parameters, on the other hand, are often non-standard extensions. They will appear in WKT formatting only if the user defined explicitly a value which is different than the default value.
Operation methods discovery
OperationMethod
describes all the parameters expected for instantiating a particular kind of
math transform. The set of operation methods known to this factory can be obtained in two ways:
The default way is to scan the classpath. See MathTransformProvider
for indications about how to add
custom coordinate operation methods in a default Apache SIS installation.
Thread safety
This class is safe for multi-thread usage if all referencedOperationMethod
instances are thread-safe.
There is typically only one MathTransformFactory
instance for the whole application.- Since:
- 0.6
- Version:
- 1.3
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Source and target coordinate systems for which a new parameterized transform is going to be used.private static final class
A factory performing no caching. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final double
Minimal precision of ellipsoid semi-major and semi-minor axis lengths, in metres.private final ThreadLocal<org.opengis.referencing.operation.OperationMethod>
The last coordinate operation method used by acreate(…)
constructor.private final Iterable<? extends org.opengis.referencing.operation.OperationMethod>
All methods specified at construction time or found on the classpath.private final ConcurrentMap<String,
org.opengis.referencing.operation.OperationMethod> private final Map<Class<?>,
OperationMethodSet> The methods by type.private DefaultMathTransformFactory
The factory with opposite caching factory, ornull
if not yet created.private final AtomicReference<Parser>
The Well Known Text parser forMathTransform
instances.private static Constructor<? extends Parser>
The constructor for WKT parsers, fetched when first needed.private final WeakHashSet<org.opengis.referencing.operation.MathTransform>
The math transforms created so far. -
Constructor Summary
ConstructorsModifierConstructorDescriptionCreates a new factory which will discover operation methods with aServiceLoader
.DefaultMathTransformFactory
(Iterable<? extends org.opengis.referencing.operation.OperationMethod> methods) Creates a new factory which will use the given operation methods.private
Creates a new factory with the same configuration than given factory but without caching. -
Method Summary
Modifier and TypeMethodDescriptioncaching
(boolean enabled) Returns a factory for the same transforms than this factory, but with caching potentially disabled.org.opengis.referencing.operation.MathTransform
createAffineTransform
(org.opengis.referencing.operation.Matrix matrix) Creates an affine transform from a matrix.org.opengis.referencing.operation.MathTransform
createBaseToDerived
(org.opengis.referencing.crs.CoordinateReferenceSystem baseCRS, org.opengis.parameter.ParameterValueGroup parameters, org.opengis.referencing.cs.CoordinateSystem derivedCS) Deprecated.org.opengis.referencing.operation.MathTransform
createConcatenatedTransform
(org.opengis.referencing.operation.MathTransform tr1, org.opengis.referencing.operation.MathTransform tr2) Creates a transform by concatenating two existing transforms.org.opengis.referencing.operation.MathTransform
createCoordinateSystemChange
(org.opengis.referencing.cs.CoordinateSystem source, org.opengis.referencing.cs.CoordinateSystem target, org.opengis.referencing.datum.Ellipsoid ellipsoid) Creates a math transform that represent a change of coordinate system.org.opengis.referencing.operation.MathTransform
createFromWKT
(String text) Creates a math transform object from a Well Known Text (WKT).org.opengis.referencing.operation.MathTransform
createFromXML
(String xml) Deprecated.org.opengis.referencing.operation.MathTransform
createParameterizedTransform
(org.opengis.parameter.ParameterValueGroup parameters) Deprecated.Replaced bycreateParameterizedTransform(ParameterValueGroup, Context)
where theContext
argument can be null.org.opengis.referencing.operation.MathTransform
createParameterizedTransform
(org.opengis.parameter.ParameterValueGroup parameters, DefaultMathTransformFactory.Context context) Creates a transform from a group of parameters.org.opengis.referencing.operation.MathTransform
createPassThroughTransform
(int firstAffectedCoordinate, org.opengis.referencing.operation.MathTransform subTransform, int numTrailingCoordinates) Creates a transform which passes through a subset of coordinates to another transform.private static void
ensureDimensionChangeAllowed
(org.opengis.referencing.operation.MathTransform parameterized, DefaultMathTransformFactory.Context context, int change, int resultDim) Checks whetherswapAndScaleAxes(MathTransform, Context)
should accept to adjust the number of transform dimensions.Set<org.opengis.referencing.operation.OperationMethod>
getAvailableMethods
(Class<? extends org.opengis.referencing.operation.SingleOperation> type) Returns a set of available methods for coordinate operations of the given type.org.opengis.parameter.ParameterValueGroup
getDefaultParameters
(String method) Returns the default parameter values for a math transform using the given operation method.org.opengis.referencing.operation.OperationMethod
Returns the operation method used by the latest call to acreate(…)
constructor in the currently running thread.org.opengis.referencing.operation.OperationMethod
getOperationMethod
(String identifier) Returns the operation method for the specified name or identifier.(package private) final DefaultMathTransformFactory
Accessor forDefaultMathTransformFactory.NoCache
implementation.void
reload()
Notifies this factory that the elements provided by theIterable<OperationMethod>
may have changed.org.opengis.referencing.operation.MathTransform
swapAndScaleAxes
(org.opengis.referencing.operation.MathTransform parameterized, DefaultMathTransformFactory.Context context) Given a transform between normalized spaces, creates a transform taking in account axis directions, units of measurement and longitude rotation.private org.opengis.referencing.operation.MathTransform
unique
(org.opengis.referencing.operation.MathTransform tr) Replaces the given transform by a unique instance, if one already exists.Methods inherited from class org.apache.sis.util.iso.AbstractFactory
getVendor
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.opengis.util.Factory
getVendor
-
Field Details
-
ELLIPSOID_PRECISION
private static final double ELLIPSOID_PRECISIONMinimal precision of ellipsoid semi-major and semi-minor axis lengths, in metres. If the length difference between the axis of two ellipsoids is greater than this threshold, we will report a mismatch. This is used for logging purpose only and do not have any impact on theMathTransform
objects to be created by this factory.- See Also:
-
parserConstructor
The constructor for WKT parsers, fetched when first needed. The WKT parser is defined in the same module than this class, so we will hopefully not have security issues. But we have to use reflection because the parser class is not yet public (because we do not want to commit its API yet). -
methods
All methods specified at construction time or found on the classpath. If the iterable is an instance ofServiceLoader
, then it will be reloaded whenreload()
is invoked.All uses of this field shall be synchronized on
methods
. -
methodsByName
-
methodsByType
The methods by type. All uses of this map shall be synchronized onmethodsByType
.Note: we do not use a concurrent map here because the number of entries is expected to be very small (about 2 entries), which make concurrent algorithms hardly efficient. Furthermore, this map is not used often. -
lastMethod
The last coordinate operation method used by acreate(…)
constructor. -
pool
The math transforms created so far. This pool is used in order to return instances of existing math transforms when possible. Ifnull
, then no pool should be used. A null value is preferable when the transforms are known to be short-lived, for avoiding the cost of caching them. -
parser
The Well Known Text parser forMathTransform
instances. This parser is not thread-safe, so we need to prevent two threads from using the same instance at the same time. -
oppositeCachingPolicy
The factory with opposite caching factory, ornull
if not yet created.- See Also:
-
-
Constructor Details
-
DefaultMathTransformFactory
public DefaultMathTransformFactory()Creates a new factory which will discover operation methods with aServiceLoader
. TheOperationMethod
implementations shall be listed in the following file:DefaultMathTransformFactory
parses the above-cited files in all JAR files in order to find all available operation methods. By default, only operation methods that implement theMathTransformProvider
interface can be used by thecreate(…)
methods in this class.- See Also:
-
DefaultMathTransformFactory
public DefaultMathTransformFactory(Iterable<? extends org.opengis.referencing.operation.OperationMethod> methods) Creates a new factory which will use the given operation methods. The given iterable is stored by reference — its content is not copied — in order to allow deferredOperationMethod
constructions. Note that by default, only operation methods that implement theMathTransformProvider
interface can be used by thecreate(…)
methods in this class.Requirements
- The given iterable should not contain duplicated elements.
- The given iterable shall be stable: all elements returned by the first iteration must also be
returned by any subsequent iterations, unless
reload()
has been invoked. OperationMethod
instances should also implementMathTransformProvider
.- All
OperationMethod
instances shall be thread-safe. - The
Iterable
itself does not need to be thread-safe since all usages will be synchronized as below:
- Parameters:
methods
- the operation methods to use, stored by reference (not copied).
-
DefaultMathTransformFactory
Creates a new factory with the same configuration than given factory but without caching.
-
-
Method Details
-
caching
Returns a factory for the same transforms than this factory, but with caching potentially disabled. By default,DefaultMathTransformFactory
caches theMathTransform
instances for sharing existing instances when transforms are created many times with the same set of parameters. However, this caching may be unnecessarily costly when the transforms to create are known to be short lived. This method allows to get a factory better suited for short-lived objects.This method does not modify the state of this factory. Instead, different factory instances for the different caching policy are returned.
- Parameters:
enabled
- whether caching should be enabled.- Returns:
- a factory for the given caching policy.
- Since:
- 1.1
-
oppositeCachingPolicy
Accessor forDefaultMathTransformFactory.NoCache
implementation. -
getAvailableMethods
public Set<org.opengis.referencing.operation.OperationMethod> getAvailableMethods(Class<? extends org.opengis.referencing.operation.SingleOperation> type) Returns a set of available methods for coordinate operations of the given type. Thetype
argument can be used for filtering the kind of operations described by the returnedOperationMethod
s. The argument is usually (but not restricted to) one of the following types:Transformation
for coordinate operations described by empirically derived parameters.Conversion
for coordinate operations described by definitions.Projection
for conversions from geodetic latitudes and longitudes to plane (map) coordinates.SingleOperation
for all coordinate operations.
OperationMethod
elements than requested if thisMathTransformFactory
does not support filtering by the given type.- Specified by:
getAvailableMethods
in interfaceorg.opengis.referencing.operation.MathTransformFactory
- Parameters:
type
-SingleOperation.class
for fetching all operation methods,Projection.class
for fetching only map projection methods, etc.- Returns:
- methods available in this factory for coordinate operations of the given type.
- See Also:
-
getOperationMethod
public org.opengis.referencing.operation.OperationMethod getOperationMethod(String identifier) throws org.opengis.util.NoSuchIdentifierException Returns the operation method for the specified name or identifier. The given argument shall be either a method name (e.g. "Transverse Mercator") or one of its identifiers (e.g."EPSG:9807"
).The search is case-insensitive. Comparisons against method names can be heuristic.
If more than one method match the given identifier, then the first (according iteration order) non-deprecated matching method is returned. If all matching methods are deprecated, the first one is returned.
- Parameters:
identifier
- the name or identifier of the operation method to search.- Returns:
- the coordinate operation method for the given name or identifier.
- Throws:
org.opengis.util.NoSuchIdentifierException
- if there is no operation method registered for the specified identifier.- See Also:
-
getDefaultParameters
public org.opengis.parameter.ParameterValueGroup getDefaultParameters(String method) throws org.opengis.util.NoSuchIdentifierException Returns the default parameter values for a math transform using the given operation method. Themethod
argument is the name of anyOperationMethod
instance returned by
. Valid names are listed here.getAvailableMethods
(SingleOperation.class)This function creates new parameter instances at every call. Parameters are intended to be modified by the user before to be given to the
createParameterizedTransform(…)
method.- Specified by:
getDefaultParameters
in interfaceorg.opengis.referencing.operation.MathTransformFactory
- Parameters:
method
- the case insensitive name of the coordinate operation method to search for.- Returns:
- a new group of parameter values for the
OperationMethod
identified by the given name. - Throws:
org.opengis.util.NoSuchIdentifierException
- if there is no method registered for the given name or identifier.- See Also:
-
createParameterizedTransform
@Deprecated public org.opengis.referencing.operation.MathTransform createParameterizedTransform(org.opengis.parameter.ParameterValueGroup parameters) throws org.opengis.util.NoSuchIdentifierException, org.opengis.util.FactoryException Deprecated.Replaced bycreateParameterizedTransform(ParameterValueGroup, Context)
where theContext
argument can be null.Creates a transform from a group of parameters. The set of expected parameters varies for each operation.- Specified by:
createParameterizedTransform
in interfaceorg.opengis.referencing.operation.MathTransformFactory
- Parameters:
parameters
- the parameter values. The parameter group name shall be the name of the desired operation method.- Returns:
- the transform created from the given parameters.
- Throws:
org.opengis.util.NoSuchIdentifierException
- if there is no method for the given parameter group name.org.opengis.util.FactoryException
- if the object creation failed. This exception is thrown if some required parameter has not been supplied, or has illegal value.
-
createParameterizedTransform
public org.opengis.referencing.operation.MathTransform createParameterizedTransform(org.opengis.parameter.ParameterValueGroup parameters, DefaultMathTransformFactory.Context context) throws org.opengis.util.NoSuchIdentifierException, org.opengis.util.FactoryException Creates a transform from a group of parameters. The set of expected parameters varies for each operation. The easiest way to provide parameter values is to get an initially empty group for the desired operation by callinggetDefaultParameters(String)
, then to fill the parameter values. Example: Sometimes the"semi_major"
and"semi_minor"
parameter values are not explicitly provided, but rather inferred from the geodetic datum of the source Coordinate Reference System. If the givencontext
argument is non-null, then this method will use those contextual information for:- Inferring the
"semi_major"
,"semi_minor"
,"src_semi_major"
,"src_semi_minor"
,"tgt_semi_major"
or"tgt_semi_minor"
parameter values from the ellipsoids associated to the source or target CRS, if those parameters are not explicitly given and if they are relevant for the coordinate operation method. - Concatenating the parameterized transform with any other transforms required for performing units changes and coordinates swapping.
"semi_major"
,"semi_minor"
or other calculated values, can be obtained by a call toDefaultMathTransformFactory.Context.getCompletedParameters()
aftercreateParameterizedTransform(…)
returned. Note that the completed parameters may only have additional parameters compared to the given parameter group; existing parameter values should not be modified.The
OperationMethod
instance used by this constructor can be obtained by a call togetLastMethodUsed()
.- Parameters:
parameters
- the parameter values. The parameter group name shall be the name of the desired operation method.context
- information about the context (for example source and target coordinate systems) in which the new transform is going to be used, ornull
if none.- Returns:
- the transform created from the given parameters.
- Throws:
org.opengis.util.NoSuchIdentifierException
- if there is no method for the given parameter group name.org.opengis.util.FactoryException
- if the object creation failed. This exception is thrown if some required parameter has not been supplied, or has illegal value.- See Also:
- Inferring the
-
swapAndScaleAxes
public org.opengis.referencing.operation.MathTransform swapAndScaleAxes(org.opengis.referencing.operation.MathTransform parameterized, DefaultMathTransformFactory.Context context) throws org.opengis.util.FactoryException Given a transform between normalized spaces, creates a transform taking in account axis directions, units of measurement and longitude rotation. This method concatenates the given parameterized transform with any other transform required for performing units changes and coordinates swapping.The given
parameterized
transform shall expect normalized input coordinates and produce normalized output coordinates. SeeAxesConvention
for more information about what Apache SIS means by "normalized".Example: The most typical examples of transforms with normalized inputs/outputs are normalized map projections expecting (longitude, latitude) inputs in degrees and calculating (x, y) coordinates in metres, both of them with (East, North) axis orientations.Controlling the normalization process
Users who need a different normalized space than the default one way find more convenient to override theContext.getMatrix(ContextualParameters.MatrixRole)
method.- Parameters:
parameterized
- a transform for normalized input and output coordinates.context
- source and target coordinate systems in which the transform is going to be used.- Returns:
- a transform taking in account unit conversions and axis swapping.
- Throws:
org.opengis.util.FactoryException
- if the object creation failed.- Since:
- 0.7
- See Also:
-
ensureDimensionChangeAllowed
private static void ensureDimensionChangeAllowed(org.opengis.referencing.operation.MathTransform parameterized, DefaultMathTransformFactory.Context context, int change, int resultDim) throws org.opengis.util.FactoryException Checks whetherswapAndScaleAxes(MathTransform, Context)
should accept to adjust the number of transform dimensions. Current implementation accepts only addition or removal of ellipsoidal height, but future version may expand the list of accepted cases. The intent for this method is to catch errors caused by wrong coordinate systems associated to a parameterized transform, keeping in mind that it is notDefaultMathTransformFactory
job to handle changes between arbitrary CRS (those changes are handled byDefaultCoordinateOperationFactory
instead).Note: theparameterized
transform is a black box receiving inputs in any CS and producing outputs in any CS, not necessarily of the same kind. For that reason, we cannot useCoordinateSystems.swapAndScaleAxes(CoordinateSystem, CoordinateSystem)
between the normalized CS. We have to trust that the caller know that the coordinate systems (s)he provided are correct for the work done by the transform.- Parameters:
parameterized
- the parameterized transform, for producing an error message if needed.context
- the source and target coordinate system.change
- number of dimensions to add (if positive) or remove (if negative).resultDim
- number of dimensions after the change.- Throws:
org.opengis.util.FactoryException
-
createBaseToDerived
@Deprecated public org.opengis.referencing.operation.MathTransform createBaseToDerived(org.opengis.referencing.crs.CoordinateReferenceSystem baseCRS, org.opengis.parameter.ParameterValueGroup parameters, org.opengis.referencing.cs.CoordinateSystem derivedCS) throws org.opengis.util.NoSuchIdentifierException, org.opengis.util.FactoryException Deprecated.Creates a transform from a base CRS to a derived CS using the given parameters. If this method needs to set the values of"semi_major"
and"semi_minor"
parameters, then it sets those values directly on the givenparameters
instance – not on a clone – for allowing the caller to get back the complete parameter values. However, this method only fills missing values, it never modify existing values.- Specified by:
createBaseToDerived
in interfaceorg.opengis.referencing.operation.MathTransformFactory
- Parameters:
baseCRS
- the source coordinate reference system.parameters
- the parameter values for the transform.derivedCS
- the target coordinate system.- Returns:
- the parameterized transform from
baseCRS
toderivedCS
, including unit conversions and axis swapping. - Throws:
org.opengis.util.NoSuchIdentifierException
- if there is no transform registered for the coordinate operation method.org.opengis.util.FactoryException
- if the object creation failed. This exception is thrown if some required parameter has not been supplied, or has illegal value.
-
createCoordinateSystemChange
public org.opengis.referencing.operation.MathTransform createCoordinateSystemChange(org.opengis.referencing.cs.CoordinateSystem source, org.opengis.referencing.cs.CoordinateSystem target, org.opengis.referencing.datum.Ellipsoid ellipsoid) throws org.opengis.util.FactoryException Creates a math transform that represent a change of coordinate system. If exactly one argument is an ellipsoidal coordinate systems, then theellipsoid
argument is mandatory. In all other cases (including the case where both coordinate systems are ellipsoidal), the ellipsoid argument is ignored and can benull
.Design note: this method does not accept separated ellipsoid arguments forsource
andtarget
because this method should not be used for datum shifts. If the two given coordinate systems are ellipsoidal, then they are assumed to use the same ellipsoid. If different ellipsoids are desired, then a parameterized transform like "Molodensky", "Geocentric translations", "Coordinate Frame Rotation" or "Position Vector transformation" should be used instead.- Parameters:
source
- the source coordinate system.target
- the target coordinate system.ellipsoid
- the ellipsoid ofEllipsoidalCS
, ornull
if none.- Returns:
- a conversion from the given source to the given target coordinate system.
- Throws:
org.opengis.util.FactoryException
- if the conversion cannot be created.- Since:
- 0.8
-
createAffineTransform
public org.opengis.referencing.operation.MathTransform createAffineTransform(org.opengis.referencing.operation.Matrix matrix) throws org.opengis.util.FactoryException Creates an affine transform from a matrix. If the transform input dimension isM
, and output dimension isN
, then the matrix will have size[N+1][M+1]
. The +1 in the matrix dimensions allows the matrix to do a shift, as well as a rotation. The[M][j]
element of the matrix will be the j'th coordinate of the moved origin. The[i][N]
element of the matrix will be 0 for i less thanM
, and 1 for i equalsM
.- Specified by:
createAffineTransform
in interfaceorg.opengis.referencing.operation.MathTransformFactory
- Parameters:
matrix
- the matrix used to define the affine transform.- Returns:
- the affine transform.
- Throws:
org.opengis.util.FactoryException
- if the object creation failed.- See Also:
-
createConcatenatedTransform
public org.opengis.referencing.operation.MathTransform createConcatenatedTransform(org.opengis.referencing.operation.MathTransform tr1, org.opengis.referencing.operation.MathTransform tr2) throws org.opengis.util.FactoryException Creates a transform by concatenating two existing transforms. A concatenated transform acts in the same way as applying two transforms, one after the other.The dimension of the output space of the first transform must match the dimension of the input space in the second transform. In order to concatenate more than two transforms, use this constructor repeatedly.
- Specified by:
createConcatenatedTransform
in interfaceorg.opengis.referencing.operation.MathTransformFactory
- Parameters:
tr1
- the first transform to apply to points.tr2
- the second transform to apply to points.- Returns:
- the concatenated transform.
- Throws:
org.opengis.util.FactoryException
- if the object creation failed.- See Also:
-
createPassThroughTransform
public org.opengis.referencing.operation.MathTransform createPassThroughTransform(int firstAffectedCoordinate, org.opengis.referencing.operation.MathTransform subTransform, int numTrailingCoordinates) throws org.opengis.util.FactoryException Creates a transform which passes through a subset of coordinates to another transform. This allows transforms to operate on a subset of coordinates.Example: Giving (latitude, longitude, height) coordinates, a pass through transform can convert the height values from meters to feet without affecting the (latitude, longitude) values.The resulting transform will have the following dimensions:- Specified by:
createPassThroughTransform
in interfaceorg.opengis.referencing.operation.MathTransformFactory
- Parameters:
firstAffectedCoordinate
- the lowest index of the affected coordinates.subTransform
- transform to use for affected coordinates.numTrailingCoordinates
- number of trailing coordinates to pass through. Affected coordinates will range fromfirstAffectedCoordinate
inclusive todimTarget-numTrailingCoordinates
exclusive.- Returns:
- a pass through transform.
- Throws:
org.opengis.util.FactoryException
- if the object creation failed.
-
createFromXML
@Deprecated public org.opengis.referencing.operation.MathTransform createFromXML(String xml) throws org.opengis.util.FactoryException Deprecated.There is no XML format for math transforms.- Specified by:
createFromXML
in interfaceorg.opengis.referencing.operation.MathTransformFactory
- Parameters:
xml
- math transform encoded in XML format.- Throws:
org.opengis.util.FactoryException
- if the object creation failed.
-
createFromWKT
public org.opengis.referencing.operation.MathTransform createFromWKT(String text) throws org.opengis.util.FactoryException Creates a math transform object from a Well Known Text (WKT). If the given text contains non-fatal anomalies (unknown or unsupported WKT elements, inconsistent unit definitions, etc.), warnings may be reported in a logger named"org.apache.sis.io.wkt"
.Note that the WKT format is not always lossless. A
MathTransform
recreated from WKT may be non-invertible even if the original transform was invertible. For example if an "Affine" operation is defined by a non-square matrix, Apache SIS implementation sometimes has "hidden" information about the inverse matrix but those information are lost at WKT formatting time. A similar "hidden" information lost may also happen withWraparoundTransform
, also making that transform non-invertible.- Specified by:
createFromWKT
in interfaceorg.opengis.referencing.operation.MathTransformFactory
- Specified by:
createFromWKT
in interfaceParser
- Parameters:
text
- math transform encoded in Well-Known Text format.- Returns:
- the math transform (never
null
). - Throws:
org.opengis.util.FactoryException
- if the Well-Known Text cannot be parsed, or if the math transform creation failed from some other reason.
-
unique
private org.opengis.referencing.operation.MathTransform unique(org.opengis.referencing.operation.MathTransform tr) Replaces the given transform by a unique instance, if one already exists. -
getLastMethodUsed
public org.opengis.referencing.operation.OperationMethod getLastMethodUsed()Returns the operation method used by the latest call to acreate(…)
constructor in the currently running thread. Returnsnull
if not applicable.Invoking
getLastMethodUsed()
can be useful after a call tocreateParameterizedTransform(…)
.- Specified by:
getLastMethodUsed
in interfaceorg.opengis.referencing.operation.MathTransformFactory
- Returns:
- the last method used by a
create(…)
constructor, ornull
if unknown of unsupported. - See Also:
-
reload
public void reload()Notifies this factory that the elements provided by theIterable<OperationMethod>
may have changed. This method performs the following steps:- Clears all caches.
- If the
Iterable
given at construction time is an instance ofServiceLoader
, invokes itsreload()
method.
-
createParameterizedTransform(ParameterValueGroup, Context)
.