Class MapProjection

All Implemented Interfaces:
Serializable, Formattable, MathTransformProvider, Deprecable, LenientComparable, org.opengis.referencing.IdentifiedObject, org.opengis.referencing.operation.OperationMethod
Direct Known Subclasses:
AbstractLambert, AbstractMercator, AbstractStereographic, AlbersEqualArea, AzimuthalEquidistantSpherical, CassiniSoldner, LambertAzimuthalEqualArea, LambertCylindricalEqualArea, LambertCylindricalEqualAreaSpherical, ModifiedAzimuthalEquidistant, Mollweide, Orthographic, Polyconic, SatelliteTracking, Sinusoidal

public abstract class MapProjection extends AbstractProvider
Base class for most two-dimensional map projection providers defined in this package. This base class defines some descriptors for the most commonly used parameters. Subclasses will declare additional parameters and group them in a descriptor group named PARAMETERS.
Since:
0.6
Version:
1.3
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Serial number for inter-operability with different versions.
      See Also:
    • SEMI_MAJOR

      public static final DefaultParameterDescriptor<Double> SEMI_MAJOR
      All names known to Apache SIS for the semi-major parameter. This parameter is mandatory and has no default value. The range of valid values is (0 … ∞).

      Some names for this parameter are "semi_major", "SemiMajorAxis" and "a".

      Parameter names
      OGC: semi_major
      ESRI: Semi_Major
      NetCDF: semi_major_axis
      GeoTIFF: SemiMajorAxis
      Proj4: a
      Notes:
      • Value domain: (0.0 … ∞) m
      • No default value
    • SEMI_MINOR

      public static final DefaultParameterDescriptor<Double> SEMI_MINOR
      All names known to Apache SIS for the semi-minor parameter. This parameter is mandatory and has no default value. The range of valid values is (0 … ∞).

      Some names for this parameter are "semi_minor", "SemiMinorAxis" and "b".

      Parameter names
      OGC: semi_minor
      ESRI: Semi_Minor
      NetCDF: semi_minor_axis
      GeoTIFF: SemiMinorAxis
      Proj4: b
      Notes:
      • Value domain: (0.0 … ∞) m
      • No default value
    • ECCENTRICITY

      public static final DefaultParameterDescriptor<Double> ECCENTRICITY
      The ellipsoid eccentricity, computed from the semi-major and semi-minor axis lengths. This a SIS-specific parameter.
      Parameter names
      SIS: eccentricity
      Notes:
      • Value domain: [0.0 … 1.0]
      • No default value
    • redimensioned

      @Deprecated private org.opengis.referencing.operation.OperationMethod redimensioned
      Deprecated.
      ISO 19111:2019 removed source/target dimensions attributes.
      The three-dimensional counterpart of this two-dimensional map projection. This is created when first needed.
      See Also:
  • Constructor Details

    • MapProjection

      protected MapProjection(Class<? extends org.opengis.referencing.operation.Projection> operationType, org.opengis.parameter.ParameterDescriptorGroup parameters)
      Constructs a math transform provider from a set of parameters. The provider identifiers will be the same than the parameter ones.
      Parameters:
      operationType - interface of the CoordinateOperation instances that use this projection.
      parameters - the set of parameters (never null).
  • Method Details

    • redimension

      @Deprecated public final org.opengis.referencing.operation.OperationMethod redimension(int sourceDimensions, int targetDimensions)
      Deprecated.
      ISO 19111:2019 removed source/target dimensions attributes.
      Returns this operation method with the specified number of dimensions. The number of dimensions can be only 2 or 3, and must be the same for source and target CRS.
      Overrides:
      redimension in class DefaultOperationMethod
      Parameters:
      sourceDimensions - the desired number of input dimensions.
      targetDimensions - the desired number of output dimensions.
      Returns:
      the redimensioned projection method, or this if no change is needed.
      Since:
      0.8
    • validate

      public static void validate(org.opengis.parameter.ParameterDescriptor<? extends Number> descriptor, double value) throws IllegalArgumentException
      Validates the given parameter value. This method duplicates the verification already done by DefaultParameterValue.setValue(Object, Unit). But we check again because we have no guarantee that the parameters given by the user were instances of DefaultParameterValue, or that the descriptor associated to the user-specified ParameterValue has sufficient information.
      Parameters:
      descriptor - the descriptor that specify the parameter to validate.
      value - the parameter value in the units given by the descriptor.
      Throws:
      IllegalArgumentException - if the given value is out of bounds.
      See Also:
    • createMathTransform

      public final org.opengis.referencing.operation.MathTransform createMathTransform(org.opengis.referencing.operation.MathTransformFactory factory, org.opengis.parameter.ParameterValueGroup parameters) throws org.opengis.parameter.ParameterNotFoundException, org.opengis.util.FactoryException
      Creates a map projection from the specified group of parameter values.
      Parameters:
      factory - the factory to use for creating and concatenating the (de)normalization transforms.
      parameters - the group of parameter values.
      Returns:
      the map projection created from the given parameter values.
      Throws:
      org.opengis.parameter.ParameterNotFoundException - if a required parameter was not found.
      org.opengis.util.FactoryException - if the map projection cannot be created.
    • createProjection

      protected abstract NormalizedProjection createProjection(Parameters parameters) throws org.opengis.parameter.ParameterNotFoundException
      Creates a map projection on an ellipsoid having a semi-major axis length of 1.
      Parameters:
      parameters - the group of parameter values.
      Returns:
      the map projection created from the given parameter values.
      Throws:
      org.opengis.parameter.ParameterNotFoundException - if a required parameter was not found.
    • sameNameAs

      private static org.opengis.util.GenericName sameNameAs(org.opengis.metadata.citation.Citation authority, org.opengis.parameter.GeneralParameterDescriptor parameters)
      Returns the name of the given authority declared in the given parameter descriptor. This method is used only as a way to avoid creating many instances of the same name.
      Parameters:
      authority - the authority for which to get the name.
      parameters - where to get name for the given authority.
      Throws:
      NoSuchElementException - if the given authority has not been found.
    • renameAlias

      static ParameterBuilder renameAlias(ParameterBuilder builder, org.opengis.parameter.ParameterDescriptor<Double> template, org.opengis.metadata.citation.Citation toRename, org.opengis.parameter.ParameterDescriptor<Double> replacement)
      Copies name, aliases and identifiers of the given template, except the alias and identifiers of the given authority which are replaced by the alias and identifiers of the same authority in replacement.
      Parameters:
      builder - an initially clean builder where to add the names and identifiers.
      template - the parameter from which to copy names and identifiers.
      toRename - authority of the alias to rename.
      replacement - the parameter from which to get the new name for the alias to rename.
      Returns:
      the given builder, for method call chaining.
      Since:
      0.8
    • renameAlias

      static ParameterBuilder renameAlias(ParameterBuilder builder, org.opengis.parameter.ParameterDescriptor<Double> template, org.opengis.metadata.citation.Citation s1, org.opengis.parameter.ParameterDescriptor<Double> r1, org.opengis.metadata.citation.Citation s2, org.opengis.parameter.ParameterDescriptor<Double> r2)
      Same as above renameAlias(…) but with two aliases to rename.
      Parameters:
      builder - an initially clean builder where to add the names and identifiers.
      template - the parameter from which to copy names and identifiers.
      s1 - authority of the first alias to rename.
      r1 - the parameter from which to get the new name for the first alias to rename.
      s2 - authority of the second alias to rename.
      r2 - the parameter from which to get the new name for the second alias to rename.
      Returns:
      the given builder, for method call chaining.
      Since:
      1.1
    • renameAliases

      private static void renameAliases(ParameterBuilder builder, org.opengis.parameter.ParameterDescriptor<Double> template, org.opengis.metadata.citation.Citation[] toRename, org.opengis.parameter.ParameterDescriptor<?>[] replacement)
      Implementation of renameAlias(…) methods.
    • notFormalParameter

      static org.opengis.util.InternationalString notFormalParameter(String origin)
      Creates a remarks for parameters that are not formally EPSG parameter.
      Parameters:
      origin - the name of the projection for where the parameter is formally used.
      Returns:
      a remarks saying that the parameter is actually defined in origin.