Class ServicesForMetadata
- All Implemented Interfaces:
EventListener
"sis-metadata"
module.- Since:
- 0.5
- Version:
- 1.3
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Name of anOnLineFunction
code list value, used for transferring information about the EPSG database.Fields inherited from class org.apache.sis.internal.metadata.ReferencingServices
AUTHALIC_RADIUS, NAUTICAL_MILE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addElements
(org.opengis.geometry.Envelope envelope, DefaultExtent target) Initializes a horizontal, vertical and temporal extent with the values inferred from the given envelope.createCoordinateFormat
(Locale locale, TimeZone timezone) Creates a format forDirectPosition
instances.static org.opengis.referencing.crs.SingleCRS
createParametricCRS
(Map<String, ?> properties, org.opengis.referencing.datum.Datum datum, org.opengis.referencing.cs.CoordinateSystem cs, org.opengis.referencing.crs.CRSFactory factory) Creates a parametric CRS.static org.opengis.referencing.cs.CoordinateSystem
createParametricCS
(Map<String, ?> properties, org.opengis.referencing.cs.CoordinateSystemAxis axis, org.opengis.referencing.cs.CSFactory factory) Creates a parametric CS.static org.opengis.referencing.datum.Datum
createParametricDatum
(Map<String, ?> properties, org.opengis.referencing.datum.DatumFactory factory) Creates a parametric datum.private static String
dimensionNotFound
(short resourceKey, org.opengis.referencing.crs.CoordinateReferenceSystem crs) Creates an exception message for a spatial, vertical or temporal dimension not found.org.opengis.geometry.DirectPosition
geographic
(double λ, double φ) Creates a two-dimensional geographic position associated to the default geographic CRS.org.opengis.referencing.operation.CoordinateOperationFactory
Returns the default coordinate operation factory.getInformation
(String key, Locale locale) Returns information about the Apache SIS configuration.private static org.opengis.referencing.operation.OperationMethod
getOperationMethod
(Iterable<? extends org.opengis.referencing.operation.OperationMethod> methods, String identifier) Returns the operation method for the specified name or identifier.static org.opengis.referencing.operation.OperationMethod
getOperationMethod
(org.opengis.referencing.operation.CoordinateOperationFactory opFactory, org.opengis.referencing.operation.MathTransformFactory mtFactory, String identifier) Returns the coordinate operation method for the given classification.getPreferredIdentifier
(org.opengis.referencing.IdentifiedObject object) Returns an identifier for the given object, giving precedence to EPSG identifier if available.org.opengis.util.TypeName
getValueType
(org.opengis.parameter.ParameterDescriptor<?> parameter) Returns the name of the type of values.setBounds
(org.opengis.geometry.Envelope envelope, DefaultGeographicBoundingBox target, String findOpCaller) Sets a geographic bounding box from the specified envelope.void
setBounds
(org.opengis.geometry.Envelope envelope, DefaultSpatialTemporalExtent target) Sets the geographic, vertical and temporal extents with the values inferred from the given envelope.void
setBounds
(org.opengis.geometry.Envelope envelope, DefaultTemporalExtent target) Sets a temporal extent with the value inferred from the given envelope.void
setBounds
(org.opengis.geometry.Envelope envelope, DefaultVerticalExtent target) Sets a vertical extent with the value inferred from the given envelope.private static DefaultGeographicBoundingBox
setGeographicExtent
(org.opengis.geometry.Envelope envelope, DefaultGeographicBoundingBox target, org.opengis.referencing.crs.CoordinateReferenceSystem crs, org.opengis.referencing.crs.GeographicCRS normalizedCRS, String findOpCaller) Implementation of the publicsetBounds(…, DefaultGeographicBoundingBox, …)
methods for the horizontal extent.private static void
setVerticalExtent
(org.opengis.geometry.Envelope envelope, DefaultVerticalExtent target, org.opengis.referencing.crs.CoordinateReferenceSystem crs, org.opengis.referencing.crs.VerticalCRS verticalCRS) Implementation of the publicsetBounds
methods for the vertical extent.<T> org.opengis.parameter.ParameterDescriptor
<T> toImplementation
(org.opengis.parameter.ParameterDescriptor<T> parameter) Returns a fully implemented parameter descriptor.Methods inherited from class org.apache.sis.internal.metadata.ReferencingServices
classpathChanged, getInstance
Methods inherited from class org.apache.sis.internal.system.OptionalDependency
getInstance, moduleNotFound
Methods inherited from class org.apache.sis.internal.system.SystemListener
add, databaseChanged, fireClasspathChanged, remove
-
Field Details
-
CONNECTION
Name of anOnLineFunction
code list value, used for transferring information about the EPSG database.- See Also:
-
-
Constructor Details
-
ServicesForMetadata
public ServicesForMetadata()Creates a new instance. This constructor is invoked by reflection only.
-
-
Method Details
-
dimensionNotFound
private static String dimensionNotFound(short resourceKey, org.opengis.referencing.crs.CoordinateReferenceSystem crs) Creates an exception message for a spatial, vertical or temporal dimension not found. The given key must be one ofResources.Keys
constants. -
setGeographicExtent
private static DefaultGeographicBoundingBox setGeographicExtent(org.opengis.geometry.Envelope envelope, DefaultGeographicBoundingBox target, org.opengis.referencing.crs.CoordinateReferenceSystem crs, org.opengis.referencing.crs.GeographicCRS normalizedCRS, String findOpCaller) throws org.opengis.referencing.operation.TransformException Implementation of the publicsetBounds(…, DefaultGeographicBoundingBox, …)
methods for the horizontal extent. If thecrs
argument is null, then it is caller's responsibility to ensure that the given envelope is two-dimensional.If
findOpCaller
is non-null, then this method will be executed in optional mode: some failures will cause this method to returnnull
instead of throwing an exception. Note thatTransformException
may still be thrown but not directly by this method. Warning may be logged, but in such case this method presumes that public caller is the named method fromEnvelopes
— typicallyEnvelopes.findOperation(Envelope, Envelope)
.- Parameters:
envelope
- the source envelope.target
- the target bounding box, ornull
for creating it automatically.crs
- the envelope CRS, ornull
if unknown.normalizedCRS
- the horizontal component of the given CRS, or null if thecrs
argument is null.findOpCaller
- non-null for replacing some (not all) exceptions bynull
return value.- Returns:
- the bounding box or
null
on failure. Nevernull
iffindOpCaller
argument isnull
. - Throws:
org.opengis.referencing.operation.TransformException
- if the given envelope cannot be transformed.
-
setVerticalExtent
private static void setVerticalExtent(org.opengis.geometry.Envelope envelope, DefaultVerticalExtent target, org.opengis.referencing.crs.CoordinateReferenceSystem crs, org.opengis.referencing.crs.VerticalCRS verticalCRS) Implementation of the publicsetBounds
methods for the vertical extent. If thecrs
argument is null, then it is caller's responsibility to ensure that the given envelope is one-dimensional.- Parameters:
envelope
- the source envelope.target
- the target vertical extent.crs
- the envelope CRS, ornull
if unknown.verticalCRS
- the vertical component of the given CRS, or null if thecrs
argument is null.
-
setBounds
public DefaultGeographicBoundingBox setBounds(org.opengis.geometry.Envelope envelope, DefaultGeographicBoundingBox target, String findOpCaller) throws org.opengis.referencing.operation.TransformException Sets a geographic bounding box from the specified envelope. If the envelope has no CRS, then (longitude, latitude) axis order is assumed. If the envelope CRS is not geographic, then the envelope will be transformed to a geographic CRS. IffindOpCaller
istrue
, then some failures will cause this method to returnnull
instead of throwing an exception, and warning may be logged with assumption that caller is the named method fromEnvelopes
— typicallyEnvelopes.findOperation(Envelope, Envelope)
.- Overrides:
setBounds
in classReferencingServices
- Parameters:
envelope
- the source envelope.target
- the target bounding box, ornull
for creating it automatically.findOpCaller
- non-null for replacing some (not all) exceptions bynull
return value.- Returns:
- the bounding box or
null
on failure. Nevernull
iffindOpCaller
argument isnull
. - Throws:
org.opengis.referencing.operation.TransformException
- if the given envelope cannot be transformed.
-
setBounds
public void setBounds(org.opengis.geometry.Envelope envelope, DefaultVerticalExtent target) throws org.opengis.referencing.operation.TransformException Sets a vertical extent with the value inferred from the given envelope. Only the vertical coordinates are extracted; all other coordinates are ignored.- Overrides:
setBounds
in classReferencingServices
- Parameters:
envelope
- the source envelope.target
- the target vertical extent where to store envelope information.- Throws:
org.opengis.referencing.operation.TransformException
- if no vertical component can be extracted from the given envelope.
-
setBounds
public void setBounds(org.opengis.geometry.Envelope envelope, DefaultTemporalExtent target) throws org.opengis.referencing.operation.TransformException Sets a temporal extent with the value inferred from the given envelope. Only the vertical coordinates are extracted; all other coordinates are ignored.- Overrides:
setBounds
in classReferencingServices
- Parameters:
envelope
- the source envelope.target
- the target temporal extent where to store envelope information.- Throws:
org.opengis.referencing.operation.TransformException
- if no temporal component can be extracted from the given envelope.
-
setBounds
public void setBounds(org.opengis.geometry.Envelope envelope, DefaultSpatialTemporalExtent target) throws org.opengis.referencing.operation.TransformException Sets the geographic, vertical and temporal extents with the values inferred from the given envelope. If the giventarget
has more geographic or vertical extents than needed (0 or 1), then the extraneous extents are removed.- Overrides:
setBounds
in classReferencingServices
- Parameters:
envelope
- the source envelope.target
- the target spatiotemporal extent where to store envelope information.- Throws:
org.opengis.referencing.operation.TransformException
- if no temporal component can be extracted from the given envelope.
-
addElements
public void addElements(org.opengis.geometry.Envelope envelope, DefaultExtent target) throws org.opengis.referencing.operation.TransformException Initializes a horizontal, vertical and temporal extent with the values inferred from the given envelope.- Overrides:
addElements
in classReferencingServices
- Parameters:
envelope
- the source envelope.target
- the target extent where to store envelope information.- Throws:
org.opengis.referencing.operation.TransformException
- if a coordinate transformation was required and failed.UnsupportedOperationException
- if this method requires an Apache SIS module which has been found on the classpath.
-
geographic
public org.opengis.geometry.DirectPosition geographic(double λ, double φ) Creates a two-dimensional geographic position associated to the default geographic CRS. Axis order is (longitude, latitude).- Overrides:
geographic
in classReferencingServices
- Parameters:
λ
- the longitude value.φ
- the latitude value.- Returns:
- the direct position for the given geographic coordinate.
- Since:
- 0.8
-
getPreferredIdentifier
public String getPreferredIdentifier(org.opengis.referencing.IdentifiedObject object) throws org.opengis.util.FactoryException Returns an identifier for the given object, giving precedence to EPSG identifier if available. The returned string should be of the form"AUTHORITY:CODE"
if possible (no guarantees).- Overrides:
getPreferredIdentifier
in classReferencingServices
- Parameters:
object
- the object for which to get an identifier.- Returns:
- an identifier for the given object, with preference given to EPSG codes.
- Throws:
org.opengis.util.FactoryException
- if an error occurred while searching for the EPSG code.- Since:
- 1.0
-
getValueType
public org.opengis.util.TypeName getValueType(org.opengis.parameter.ParameterDescriptor<?> parameter) Returns the name of the type of values.- Overrides:
getValueType
in classReferencingServices
- Parameters:
parameter
- parameter for which to get the name of type of values, ornull
.- Returns:
- name of type of values, or
null
if not supported by given implementation.
-
toImplementation
public <T> org.opengis.parameter.ParameterDescriptor<T> toImplementation(org.opengis.parameter.ParameterDescriptor<T> parameter) Returns a fully implemented parameter descriptor.- Overrides:
toImplementation
in classReferencingServices
- Type Parameters:
T
- the type of values.- Parameters:
parameter
- a partially implemented parameter descriptor, ornull
.- Returns:
- a fully implemented parameter descriptor, or
null
if the given argument was null.
-
createParametricCS
public static org.opengis.referencing.cs.CoordinateSystem createParametricCS(Map<String, ?> properties, org.opengis.referencing.cs.CoordinateSystemAxis axis, org.opengis.referencing.cs.CSFactory factory) throws org.opengis.util.FactoryExceptionCreates a parametric CS. This method requires the SIS factory since parametric CRS were not available in GeoAPI 3.0.This method is actually not needed anymore for
sis-metadata
module, but is still defined here for historical reason. This method is removed on SIS branches using a GeoAPI versions more recent than 3.0.- Parameters:
properties
- the coordinate system name, and optionally other properties.axis
- the axis of the parametric coordinate system.factory
- the factory to use for creating the coordinate system.- Returns:
- a parametric coordinate system using the given axes.
- Throws:
org.opengis.util.FactoryException
- if the parametric object creation failed.- Since:
- 0.7
-
createParametricDatum
public static org.opengis.referencing.datum.Datum createParametricDatum(Map<String, ?> properties, org.opengis.referencing.datum.DatumFactory factory) throws org.opengis.util.FactoryExceptionCreates a parametric datum. This method requires the SIS factory since parametric CRS were not available in GeoAPI 3.0.This method is actually not needed anymore for
sis-metadata
module, but is still defined here for historical reason. This method is removed on SIS branches using a GeoAPI versions more recent than 3.0.- Parameters:
properties
- the datum name, and optionally other properties.factory
- the factory to use for creating the datum.- Returns:
- a parametric datum using the given name.
- Throws:
org.opengis.util.FactoryException
- if the parametric object creation failed.- Since:
- 0.7
-
createParametricCRS
public static org.opengis.referencing.crs.SingleCRS createParametricCRS(Map<String, ?> properties, org.opengis.referencing.datum.Datum datum, org.opengis.referencing.cs.CoordinateSystem cs, org.opengis.referencing.crs.CRSFactory factory) throws org.opengis.util.FactoryExceptionCreates a parametric CRS. This method requires the SIS factory since parametric CRS were not available in GeoAPI 3.0.This method is actually not needed anymore for
sis-metadata
module, but is still defined here for historical reason. This method is removed on SIS branches using a GeoAPI versions more recent than 3.0.- Parameters:
properties
- the coordinate reference system name, and optionally other properties.datum
- the parametric datum.cs
- the parametric coordinate system.factory
- the factory to use for creating the coordinate reference system.- Returns:
- a parametric coordinate system using the given axes.
- Throws:
org.opengis.util.FactoryException
- if the parametric object creation failed.- Since:
- 0.7
-
createCoordinateFormat
Creates a format forDirectPosition
instances.- Overrides:
createCoordinateFormat
in classReferencingServices
- Parameters:
locale
- the locale for the newFormat
, ornull
forLocale.ROOT
.timezone
- the timezone, ornull
for UTC.- Returns:
- a
CoordinateFormat
. - Since:
- 0.8
-
getCoordinateOperationFactory
public org.opengis.referencing.operation.CoordinateOperationFactory getCoordinateOperationFactory()Returns the default coordinate operation factory.- Overrides:
getCoordinateOperationFactory
in classReferencingServices
- Returns:
- the coordinate operation factory to use.
-
getOperationMethod
public static org.opengis.referencing.operation.OperationMethod getOperationMethod(org.opengis.referencing.operation.CoordinateOperationFactory opFactory, org.opengis.referencing.operation.MathTransformFactory mtFactory, String identifier) throws org.opengis.util.FactoryException Returns the coordinate operation method for the given classification. This method checks if the givenopFactory
is a SIS implementation before to fallback on a slower fallback.This method is actually not needed anymore for
sis-metadata
module, but is still defined here for historical reason. This method is removed on SIS branches using a GeoAPI versions more recent than 3.0.- Parameters:
opFactory
- The coordinate operation factory to use if it is a SIS implementation.mtFactory
- The math transform factory to use as a fallback.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.FactoryException
- if an error occurred which searching for the given method.- Since:
- 0.6
-
getOperationMethod
private static org.opengis.referencing.operation.OperationMethod getOperationMethod(Iterable<? extends org.opengis.referencing.operation.OperationMethod> methods, String identifier) 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"
).- Parameters:
methods
- the method candidates.identifier
- the name or identifier of the operation method to search.- Returns:
- the coordinate operation method for the given name or identifier, or
null
if none. - Since:
- 0.6
- See Also:
-
getInformation
Returns information about the Apache SIS configuration. See super-class for a list of keys.- Overrides:
getInformation
in classReferencingServices
- Parameters:
key
- a key identifying the information to return.locale
- language to use if possible.- Returns:
- the information, or
null
if none. - See Also:
-