Author: desruisseaux
Date: Mon Jul 18 14:57:05 2016
New Revision: 1753236
URL: http://svn.apache.org/viewvc?rev=1753236&view=rev
Log:
Add "Lambert Cylindrical Equal Area (Spherical)" projection.
Added:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertCylindricalEqualAreaSpherical.java
- copied, changed from r1753204,
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertCylindricalEqualArea.java
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertCylindricalEqualArea.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/CylindricalEqualArea.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.java
sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/CylindricalEqualAreaTest.java
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertCylindricalEqualArea.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertCylindricalEqualArea.java?rev=1753236&r1=1753235&r2=1753236&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertCylindricalEqualArea.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertCylindricalEqualArea.java
[UTF-8] Mon Jul 18 14:57:05 2016
@@ -23,6 +23,7 @@ import org.opengis.referencing.operation
import org.apache.sis.metadata.iso.citation.Citations;
import org.apache.sis.parameter.Parameters;
import org.apache.sis.referencing.operation.projection.NormalizedProjection;
+import org.apache.sis.referencing.operation.projection.CylindricalEqualArea;
/**
@@ -111,6 +112,6 @@ public final class LambertCylindricalEqu
*/
@Override
protected NormalizedProjection createProjection(final Parameters
parameters) {
- return new
org.apache.sis.referencing.operation.projection.CylindricalEqualArea(this,
parameters);
+ return new CylindricalEqualArea(this, parameters);
}
}
Copied:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertCylindricalEqualAreaSpherical.java
(from r1753204,
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertCylindricalEqualArea.java)
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertCylindricalEqualAreaSpherical.java?p2=sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertCylindricalEqualAreaSpherical.java&p1=sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertCylindricalEqualArea.java&r1=1753204&r2=1753236&rev=1753236&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertCylindricalEqualArea.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertCylindricalEqualAreaSpherical.java
[UTF-8] Mon Jul 18 14:57:05 2016
@@ -17,54 +17,32 @@
package org.apache.sis.internal.referencing.provider;
import javax.xml.bind.annotation.XmlTransient;
-import org.opengis.parameter.ParameterDescriptor;
import org.opengis.parameter.ParameterDescriptorGroup;
import org.opengis.referencing.operation.CylindricalProjection;
-import org.apache.sis.metadata.iso.citation.Citations;
import org.apache.sis.parameter.Parameters;
import org.apache.sis.referencing.operation.projection.NormalizedProjection;
+import org.apache.sis.referencing.operation.projection.CylindricalEqualArea;
/**
- * The provider for <cite>"Lambert Cylindrical Equal Area"</cite> projection
(EPSG:9835).
+ * The provider for <cite>"Lambert Cylindrical Equal Area (Spherical)"</cite>
projection (EPSG:9834).
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.8
* @version 0.8
* @module
- *
- * @see <a
href="http://www.remotesensing.org/geotiff/proj_list/cylindrical_equal_area.html">Cylindrical
Equal Area on RemoteSensing.org</a>
*/
@XmlTransient
-public final class LambertCylindricalEqualArea extends MapProjection {
+public final class LambertCylindricalEqualAreaSpherical extends MapProjection {
/**
* For cross-version compatibility.
*/
- private static final long serialVersionUID = -672278344635217838L;
-
- /**
- * The operation parameter descriptor for the <cite>Latitude of 1st
standard parallel</cite> (φ₁) parameter value.
- * Valid values range is (-90 … 90)° and default value is 0°.
- */
- public static final ParameterDescriptor<Double> STANDARD_PARALLEL =
Equirectangular.STANDARD_PARALLEL;
-
- /**
- * The operation parameter descriptor for the <cite>Longitude of natural
origin</cite> (λ₀) parameter value.
- * Valid values range is [-180 … 180]° and default value is 0°.
- */
- public static final ParameterDescriptor<Double> LONGITUDE_OF_ORIGIN =
Mercator1SP.LONGITUDE_OF_ORIGIN;
-
- /**
- * The operation parameter descriptor for the <cite>False easting</cite>
(FE) parameter value.
- * Valid values range is unrestricted and default value is 0 metre.
- */
- public static final ParameterDescriptor<Double> FALSE_EASTING =
Equirectangular.FALSE_EASTING;
+ private static final long serialVersionUID = 1456941129750586197L;
/**
- * The operation parameter descriptor for the <cite>False northing</cite>
(FN) parameter value.
- * Valid values range is unrestricted and default value is 0 metre.
+ * The EPSG identifier, to be preferred to the name when available.
*/
- public static final ParameterDescriptor<Double> FALSE_NORTHING =
Equirectangular.FALSE_NORTHING;
+ public static final String IDENTIFIER = "9834";
/**
* The group of all parameters expected by this coordinate operation.
@@ -72,25 +50,20 @@ public final class LambertCylindricalEqu
static final ParameterDescriptorGroup PARAMETERS;
static {
PARAMETERS = builder()
- .addIdentifier( "9835")
- .addName( "Lambert Cylindrical Equal Area")
- .addName(Citations.OGC, "Cylindrical_Equal_Area")
- .addName(Citations.ESRI, "Cylindrical_Equal_Area")
- .addName(Citations.GEOTIFF, "CT_CylindricalEqualArea")
- .addName(Citations.PROJ4, "cea")
- .addIdentifier(Citations.GEOTIFF, "28")
+ .addIdentifier(IDENTIFIER)
+ .addName("Lambert Cylindrical Equal Area (Spherical)")
.createGroupForMapProjection(
- STANDARD_PARALLEL,
- LONGITUDE_OF_ORIGIN,
+ LambertCylindricalEqualArea.STANDARD_PARALLEL,
+ LambertCylindricalEqualArea.LONGITUDE_OF_ORIGIN,
Mercator2SP.SCALE_FACTOR, // Not formally a
Cylindrical Equal Area parameter.
- FALSE_EASTING,
- FALSE_NORTHING);
+ LambertCylindricalEqualArea.FALSE_EASTING,
+ LambertCylindricalEqualArea.FALSE_NORTHING);
}
/**
* Constructs a new provider.
*/
- public LambertCylindricalEqualArea() {
+ public LambertCylindricalEqualAreaSpherical() {
super(PARAMETERS);
}
@@ -111,6 +84,6 @@ public final class LambertCylindricalEqu
*/
@Override
protected NormalizedProjection createProjection(final Parameters
parameters) {
- return new
org.apache.sis.referencing.operation.projection.CylindricalEqualArea(this,
parameters);
+ return new CylindricalEqualArea(this, parameters);
}
}
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/CylindricalEqualArea.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/CylindricalEqualArea.java?rev=1753236&r1=1753235&r2=1753236&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/CylindricalEqualArea.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/CylindricalEqualArea.java
[UTF-8] Mon Jul 18 14:57:05 2016
@@ -25,6 +25,7 @@ import org.opengis.referencing.operation
import org.opengis.referencing.operation.TransformException;
import org.opengis.util.FactoryException;
import org.apache.sis.internal.referencing.provider.Mercator1SP;
+import
org.apache.sis.internal.referencing.provider.LambertCylindricalEqualAreaSpherical;
import org.apache.sis.internal.util.DoubleDouble;
import org.apache.sis.parameter.Parameters;
import org.apache.sis.referencing.operation.matrix.Matrix2;
@@ -69,6 +70,33 @@ public class CylindricalEqualArea extend
private static final long serialVersionUID = 8840395516658904421L;
/**
+ * Returns the variant of the projection based on the name and identifier
of the given operation method.
+ * See {@link #variant} for the list of possible values.
+ */
+ private static byte getVariant(final OperationMethod method) {
+ if (identMatch(method, "(?i).*\\bSpherical\\b.*",
LambertCylindricalEqualAreaSpherical.IDENTIFIER)) {
+ return Initializer.AUTHALIC_RADIUS;
+ }
+ return 0;
+ }
+
+ /**
+ * The type of Cylindrical Equal Area projection. Possible values are:
+ *
+ * <ul>
+ * <li>0 if this projection is a default variant.</li>
+ * <li>{@link Initializer#AUTHALIC_RADIUS} if this projection is the
"Lambert Cylindrical Equal Area (Spherical)"
+ * case, in which case the semi-major and semi-minor axis lengths
should be replaced by the authalic radius
+ * (this replacement is performed by the {@link Initializer}
constructor).</li>
+ * </ul>
+ *
+ * Other cases may be added in the future.
+ *
+ * @see #getVariant(OperationMethod)
+ */
+ private final byte variant;
+
+ /**
* Value of {@link #qm(double)} function (part of Snyder equation (3-12))
at pole (sinφ = 1).
*
* @see #computeCoefficients()
@@ -99,7 +127,7 @@ public class CylindricalEqualArea extend
*/
roles.put(ParameterRole.FALSE_EASTING, FALSE_EASTING);
roles.put(ParameterRole.FALSE_NORTHING, FALSE_NORTHING);
- return new Initializer(method, parameters, roles, (byte) 0);
+ return new Initializer(method, parameters, roles, getVariant(method));
}
/**
@@ -109,6 +137,7 @@ public class CylindricalEqualArea extend
@Workaround(library="JDK", version="1.7")
private CylindricalEqualArea(final Initializer initializer) {
super(initializer);
+ variant = initializer.variant;
final MatrixSIS denormalize =
context.getMatrix(ContextualParameters.MatrixRole.DENORMALIZATION);
/*
* The longitude of origin is normally subtracted in the 'normalize'
matrix. But in the particular of case
@@ -164,6 +193,7 @@ public class CylindricalEqualArea extend
*/
CylindricalEqualArea(final CylindricalEqualArea other) {
super(other);
+ variant = other.variant;
qmPolar = other.qmPolar;
}
@@ -182,7 +212,7 @@ public class CylindricalEqualArea extend
@Override
public MathTransform createMapProjection(final MathTransformFactory
factory) throws FactoryException {
CylindricalEqualArea kernel = this;
- if (eccentricity == 0) {
+ if (variant == Initializer.AUTHALIC_RADIUS || eccentricity == 0) {
kernel = new Spherical(this);
}
return context.completeTransform(factory, kernel);
@@ -211,7 +241,7 @@ public class CylindricalEqualArea extend
/*
* End of map projection. Now compute the derivative, if requested.
*/
- return derivate ? new Matrix2(1, 0, 0, 2*dqm_dφ(sinφ, cos(φ))) : null;
+ return derivate ? new Matrix2(1, 0, 0, dqm_dφ(sinφ, cos(φ))) : null;
}
/**
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.java?rev=1753236&r1=1753235&r2=1753236&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.java
[UTF-8] Mon Jul 18 14:57:05 2016
@@ -20,6 +20,7 @@ import java.util.Map;
import org.opengis.parameter.ParameterDescriptor;
import org.opengis.parameter.ParameterNotFoundException;
import org.opengis.referencing.operation.OperationMethod;
+import org.apache.sis.internal.referencing.Formulas;
import org.apache.sis.internal.referencing.provider.MapProjection;
import org.apache.sis.internal.util.Constants;
import org.apache.sis.parameter.Parameters;
@@ -88,20 +89,33 @@ final class Initializer {
final DoubleDouble eccentricitySquared;
/**
- * Map projection variant. This is a convenience field left at
- * the discretion of {@link NormalizedProjection} subclasses.
+ * Map projection variant.
+ * Values from 0 to 127 inclusive are convenience values at the discretion
of {@link NormalizedProjection} subclasses.
+ * Values from 128 to 255 inclusive are values handled in a special way by
{@link Initializer} constructor.
*/
final byte variant;
/**
+ * A {@link #variant} value telling the constructor to computing the
authalic radius instead than using
+ * the semi-major and semi-minor axis lengths directly.
+ *
+ * <p>Note that this value is not necessarily equivalent to the {@code
SPHERICAL} value defined in some
+ * map projection, because EPSG guidance notes recommend different
approaches for spherical implementations.
+ * For example the Mercator projection will use the radius of conformal
sphere instead than the authalic radius.</p>
+ */
+ static final byte AUTHALIC_RADIUS = (byte) 128;
+
+ /**
* Creates a new initializer. The parameters are described in
* {@link NormalizedProjection#NormalizedProjection(OperationMethod,
Parameters, Map)}.
*
- * @param method Description of the map projection parameters.
- * @param parameters The parameters of the projection to be created.
- * @param roles Parameters to look for <cite>central meridian</cite>,
<cite>scale factor</cite>,
- * <cite>false easting</cite>, <cite>false
northing</cite> and other values.
- * @param variant Convenience field left at the discretion of {@link
NormalizedProjection} subclasses.
+ * @param method description of the map projection parameters.
+ * @param parameters the parameters of the projection to be created.
+ * @param roles parameters to look for <cite>central
meridian</cite>, <cite>scale factor</cite>,
+ * <cite>false easting</cite>, <cite>false
northing</cite> and other values.
+ * @param variant convenience field left at the discretion of {@link
NormalizedProjection} subclasses.
+ * Values equal to greater than 128 are special values
recognized by this constructor
+ * (see {@link #AUTHALIC_RADIUS}).
*/
Initializer(final OperationMethod method, final Parameters parameters,
final Map<ParameterRole, ? extends ParameterDescriptor<? extends
Number>> roles,
@@ -115,8 +129,7 @@ final class Initializer {
this.variant = variant;
/*
* Note: we do not use Map.getOrDefault(K,V) below because the user
could have explicitly associated
- * a null value to keys (we are paranoiac...) and because it conflicts
with the "? extends" part of
- * in this constructor signature.
+ * a null value to keys (we are paranoiac...) and because it conflicts
with the "? extends" parts.
*/
ParameterDescriptor<? extends Number> semiMajor =
roles.get(ParameterRole.SEMI_MAJOR);
ParameterDescriptor<? extends Number> semiMinor =
roles.get(ParameterRole.SEMI_MINOR);
@@ -134,65 +147,70 @@ final class Initializer {
eccentricitySquared = new DoubleDouble();
DoubleDouble k = new DoubleDouble(a); // The value by which to
multiply all results of normalized projection.
if (a != b) {
- /*
- * (1) Using axis lengths: ℯ² = 1 - (b/a)²
- * (2) Using flattening; ℯ² = 2f - f² where f is the (NOT
inverse) flattening factor.
- *
- * If the inverse flattening factor is the definitive factor for
the ellipsoid, we use (2).
- * Otherwise use (1). With double-double arithmetic, this makes a
difference in the 3 last
- * digits for the WGS84 ellipsoid.
- */
- boolean isIvfDefinitive;
- try {
- isIvfDefinitive =
parameters.parameter(Constants.IS_IVF_DEFINITIVE).booleanValue();
- } catch (ParameterNotFoundException e) {
- /*
- * Should never happen with Apache SIS implementation, but may
happen if the given parameters come
- * from another implementation. We can safely abandon our
attempt to get the inverse flattening value,
- * since it was redundant with semi-minor axis length.
- */
- isIvfDefinitive = false;
- }
- /*
- * The ellipsoid parameters (a, b or ivf) are assumed accurate in
base 10 rather than in base 2,
- * because they are defined by authorities. For example the
semi-major axis length of the WGS84
- * ellipsoid is equal to exactly 6378137 metres by definition of
that ellipsoid. The DoubleDouble
- * constructor applies corrections for making those values more
accurate in base 10 rather than 2.
- */
- if (isIvfDefinitive) {
- final DoubleDouble f = new
DoubleDouble(parameters.parameter(Constants.INVERSE_FLATTENING).doubleValue());
- f.inverseDivide(1,0);
- eccentricitySquared.setFrom(f);
- eccentricitySquared.multiply(2,0);
- f.square();
- eccentricitySquared.subtract(f);
+ if (variant == AUTHALIC_RADIUS) {
+ k.value = Formulas.getAuthalicRadius(a, b);
+ k.error = 0;
} else {
- final DoubleDouble rs = new DoubleDouble(b);
- rs.divide(k); // rs = b/a
- rs.square();
- eccentricitySquared.value = 1;
- eccentricitySquared.subtract(rs);
- }
- final ParameterDescriptor<? extends Number> radius =
roles.get(ParameterRole.LATITUDE_OF_CONFORMAL_SPHERE_RADIUS);
- if (radius != null) {
/*
- * EPSG said: R is the radius of the sphere and will normally
be one of the CRS parameters.
- * If the figure of the earth used is an ellipsoid rather than
a sphere then R should be calculated
- * as the radius of the conformal sphere at the projection
origin at latitude φ₀ using the formula
- * for Rc given in section 1.2, table 3.
- *
- * Table 3 gives:
- * Radius of conformal sphere Rc = a √(1 – ℯ²) / (1 – ℯ²⋅sin²φ)
- *
- * Using √(1 – ℯ²) = b/a we rewrite as: Rc = b / (1 – ℯ²⋅sin²φ)
+ * (1) Using axis lengths: ℯ² = 1 - (b/a)²
+ * (2) Using flattening; ℯ² = 2f - f² where f is the
(NOT inverse) flattening factor.
*
- * Equivalent Java code:
- *
- * final double sinφ =
sin(toRadians(parameters.doubleValue(radius)));
- * k = b / (1 - eccentricitySquared * (sinφ*sinφ));
+ * If the inverse flattening factor is the definitive factor
for the ellipsoid, we use (2).
+ * Otherwise use (1). With double-double arithmetic, this
makes a difference in the 3 last
+ * digits for the WGS84 ellipsoid.
+ */
+ boolean isIvfDefinitive;
+ try {
+ isIvfDefinitive =
parameters.parameter(Constants.IS_IVF_DEFINITIVE).booleanValue();
+ } catch (ParameterNotFoundException e) {
+ /*
+ * Should never happen with Apache SIS implementation, but
may happen if the given parameters come
+ * from another implementation. We can safely abandon our
attempt to get the inverse flattening value,
+ * since it was redundant with semi-minor axis length.
+ */
+ isIvfDefinitive = false;
+ }
+ /*
+ * The ellipsoid parameters (a, b or ivf) are assumed accurate
in base 10 rather than in base 2,
+ * because they are defined by authorities. For example the
semi-major axis length of the WGS84
+ * ellipsoid is equal to exactly 6378137 metres by definition
of that ellipsoid. The DoubleDouble
+ * constructor applies corrections for making those values
more accurate in base 10 rather than 2.
*/
- k = rν2(sin(toRadians(parameters.doubleValue(radius))));
- k.inverseDivide(b, 0);
+ if (isIvfDefinitive) {
+ final DoubleDouble f = new
DoubleDouble(parameters.parameter(Constants.INVERSE_FLATTENING).doubleValue());
+ f.inverseDivide(1,0);
+ eccentricitySquared.setFrom(f);
+ eccentricitySquared.multiply(2,0);
+ f.square();
+ eccentricitySquared.subtract(f);
+ } else {
+ final DoubleDouble rs = new DoubleDouble(b);
+ rs.divide(k); // rs = b/a
+ rs.square();
+ eccentricitySquared.value = 1;
+ eccentricitySquared.subtract(rs);
+ }
+ final ParameterDescriptor<? extends Number> radius =
roles.get(ParameterRole.LATITUDE_OF_CONFORMAL_SPHERE_RADIUS);
+ if (radius != null) {
+ /*
+ * EPSG said: R is the radius of the sphere and will
normally be one of the CRS parameters.
+ * If the figure of the earth used is an ellipsoid rather
than a sphere then R should be calculated
+ * as the radius of the conformal sphere at the projection
origin at latitude φ₀ using the formula
+ * for Rc given in section 1.2, table 3.
+ *
+ * Table 3 gives:
+ * Radius of conformal sphere Rc = a √(1 – ℯ²) / (1 –
ℯ²⋅sin²φ)
+ *
+ * Using √(1 – ℯ²) = b/a we rewrite as: Rc = b / (1 –
ℯ²⋅sin²φ)
+ *
+ * Equivalent Java code:
+ *
+ * final double sinφ =
sin(toRadians(parameters.doubleValue(radius)));
+ * k = b / (1 - eccentricitySquared * (sinφ*sinφ));
+ */
+ k = rν2(sin(toRadians(parameters.doubleValue(radius))));
+ k.inverseDivide(b, 0);
+ }
}
}
/*
@@ -292,8 +310,8 @@ final class Initializer {
* (otherwise we get {@link Double#NaN}).</li>
* </ul>
*
- * @param sinφ The sine of the φ latitude.
- * @return Reciprocal squared of the radius of curvature of the ellipsoid
+ * @param sinφ the sine of the φ latitude.
+ * @return reciprocal squared of the radius of curvature of the ellipsoid
* perpendicular to the meridian at latitude φ.
*/
private DoubleDouble rν2(final double sinφ) {
@@ -322,8 +340,8 @@ final class Initializer {
* the use of φ₀ (or φ₁ as relevant to method) for φ is suggested, except
if the projection is
* equal area when the radius of authalic sphere should be used.
*
- * @param sinφ The sine of the φ latitude.
- * @return Radius of the conformal sphere at latitude φ.
+ * @param sinφ the sine of the φ latitude.
+ * @return radius of the conformal sphere at latitude φ.
*/
final double radiusOfConformalSphere(final double sinφ) {
final DoubleDouble Rc = verbatim(1);
@@ -341,9 +359,9 @@ final class Initializer {
* The result is returned as a {@code double} because the limited
precision of {@code sinφ} and {@code cosφ}
* makes the error term meaningless. We use double-double arithmetic only
for intermediate calculation.
*
- * @param sinφ The sine of the φ latitude.
- * @param cosφ The cosine of the φ latitude.
- * @return Scale factor at latitude φ.
+ * @param sinφ the sine of the φ latitude.
+ * @param cosφ the cosine of the φ latitude.
+ * @return scale factor at latitude φ.
*/
final double scaleAtφ(final double sinφ, final double cosφ) {
final DoubleDouble s = rν2(sinφ);
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod?rev=1753236&r1=1753235&r2=1753236&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod
[UTF-8] Mon Jul 18 14:57:05 2016
@@ -28,6 +28,7 @@ org.apache.sis.internal.referencing.prov
org.apache.sis.internal.referencing.provider.RegionalMercator
org.apache.sis.internal.referencing.provider.MillerCylindrical
org.apache.sis.internal.referencing.provider.LambertCylindricalEqualArea
+org.apache.sis.internal.referencing.provider.LambertCylindricalEqualAreaSpherical
org.apache.sis.internal.referencing.provider.LambertConformal1SP
org.apache.sis.internal.referencing.provider.LambertConformal2SP
org.apache.sis.internal.referencing.provider.LambertConformalWest
Modified:
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java?rev=1753236&r1=1753235&r2=1753236&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java
[UTF-8] Mon Jul 18 14:57:05 2016
@@ -80,6 +80,7 @@ public final strictfp class ProvidersTes
RegionalMercator.class,
MillerCylindrical.class,
LambertCylindricalEqualArea.class,
+ LambertCylindricalEqualAreaSpherical.class,
LambertConformal1SP.class,
LambertConformal2SP.class,
LambertConformalWest.class,
Modified:
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/CylindricalEqualAreaTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/CylindricalEqualAreaTest.java?rev=1753236&r1=1753235&r2=1753236&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/CylindricalEqualAreaTest.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/CylindricalEqualAreaTest.java
[UTF-8] Mon Jul 18 14:57:05 2016
@@ -21,8 +21,12 @@ import org.opengis.referencing.operation
import org.opengis.test.ToleranceModifier;
import org.apache.sis.internal.referencing.Formulas;
import
org.apache.sis.internal.referencing.provider.LambertCylindricalEqualArea;
+import
org.apache.sis.internal.referencing.provider.LambertCylindricalEqualAreaSpherical;
+import org.apache.sis.test.DependsOnMethod;
import org.junit.Test;
+import static java.lang.StrictMath.*;
+
/**
* Tests the {@link CylindricalEqualArea} class.
@@ -44,7 +48,21 @@ public final strictfp class CylindricalE
}
/**
- * Tests projection of a point the the in ellipsoidal case.
+ * Tests the derivatives at a few points. This method compares the
derivatives computed by
+ * the projection with an estimation of derivatives computed by the finite
differences method.
+ *
+ * @throws TransformException if an error occurred while projecting a
point.
+ */
+ private void testDerivative() throws TransformException {
+ final double delta = toRadians(100.0 / 60) / 1852; //
Approximatively 100 metres.
+ derivativeDeltas = new double[] {delta, delta};
+ tolerance = 1E-6; // More severe
than Formulas.LINEAR_TOLERANCE.
+ verifyDerivative(toRadians(15), toRadians( 30));
+ verifyDerivative(toRadians(10), toRadians(-60));
+ }
+
+ /**
+ * Tests <cite>Lambert Cylindrical Equal Area</cite> projection of a point
in the in ellipsoidal case.
*
* @throws FactoryException if an error occurred while creating the map
projection.
* @throws TransformException if an error occurred while projecting a
point.
@@ -60,24 +78,51 @@ public final strictfp class CylindricalE
final double y = 110568.81;
verifyTransform(new double[] {λ, φ, -λ, φ, λ, -φ, -λ, -φ},
new double[] {x, y, -x, y, x, -y, -x, -y});
+ testDerivative();
}
/**
- * Tests projection of a point the the in spherical case.
+ * Tests <cite>Lambert Cylindrical Equal Area</cite> projection of a point
in the in spherical case.
*
* @throws FactoryException if an error occurred while creating the map
projection.
* @throws TransformException if an error occurred while projecting a
point.
*/
@Test
+ @DependsOnMethod("testEllipsoidal")
public void testSpherical() throws FactoryException, TransformException {
createCompleteProjection(false, 0, 0);
tolerance = Formulas.LINEAR_TOLERANCE;
toleranceModifier = ToleranceModifier.PROJECTION;
final double λ = 2;
final double φ = 1;
- final double x = 222390.10;
+ final double x = 222390.10; // Anti-regression values (not
from an external source).
+ final double y = 111189.40;
+ verifyTransform(new double[] {λ, φ, -λ, φ, λ, -φ, -λ, -φ},
+ new double[] {x, y, -x, y, x, -y, -x, -y});
+ testDerivative();
+ }
+
+ /**
+ * Tests <cite>Lambert Cylindrical Equal Area (Spherical)</cite>
projection.
+ * The difference between this test and {@link #testSpherical()} is that
this case shall
+ * compute the radius of the conformal sphere instead than using the
semi-major axis length.
+ * The result near the equator are almost the same however.
+ *
+ * @throws FactoryException if an error occurred while creating the map
projection.
+ * @throws TransformException if an error occurred while projecting a
point.
+ */
+ @Test
+ @DependsOnMethod("testSpherical")
+ public void testSphericalWithConformalSphereRadius() throws
FactoryException, TransformException {
+ createCompleteProjection(new LambertCylindricalEqualAreaSpherical(),
true, 0, 0, 0, 1, 0, 0);
+ tolerance = Formulas.LINEAR_TOLERANCE;
+ toleranceModifier = ToleranceModifier.PROJECTION;
+ final double λ = 2;
+ final double φ = 1;
+ final double x = 222390.10; // Anti-regression values (not
from an external source).
final double y = 111189.40;
verifyTransform(new double[] {λ, φ, -λ, φ, λ, -φ, -λ, -φ},
new double[] {x, y, -x, y, x, -y, -x, -y});
+ testDerivative();
}
}