This is an automated email from the ASF dual-hosted git repository. desruisseaux pushed a commit to branch geoapi-4.0 in repository https://gitbox.apache.org/repos/asf/sis.git
commit 232e335c53d571ac092bec3537da55daa6392aae Author: Martin Desruisseaux <[email protected]> AuthorDate: Sat Apr 6 13:42:59 2019 +0200 Add "Pseudo Plate Carrée" pseudo-projection (EPSG:9825) as a potential fallback when map projection is not specified in a netCDF file. --- .../referencing/provider/Equirectangular.java | 5 +- .../referencing/provider/PseudoPlateCarree.java | 71 ++++++++++++++++++++++ ...g.opengis.referencing.operation.OperationMethod | 1 + .../referencing/provider/ProvidersTest.java | 1 + 4 files changed, 74 insertions(+), 4 deletions(-) diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Equirectangular.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Equirectangular.java index d7e8c31..ea2d742 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Equirectangular.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Equirectangular.java @@ -49,10 +49,6 @@ import static java.lang.Math.*; * because it does not create non-liner kernel. Instead, the projection created by this class is implemented * by an affine transform.</p> * - * <p>We do not provide <cite>"Pseudo Plate Carrée"</cite> projection (EPSG:9825) at this time because that - * pseudo-projection is only the identity transform. Even the semi-major and semi-minor axis lengths are set - * to 1.</p> - * * <p>This provider is <strong>not</strong> suitable for the <cite>Equidistant Cylindrical</cite> projection * (EPSG:1028, <span class="deprecated">EPSG:9842</span>). EPSG defines Equidistant Cylindrical projection as * the ellipsoidal case of this projection, which uses a more complicated formula than the affine transform @@ -67,6 +63,7 @@ import static java.lang.Math.*; * @author Martin Desruisseaux (Geomatys) * @version 0.8 * + * @see PseudoPlateCarre * @see <a href="http://geotiff.maptools.org/proj_list/equirectangular.html">GeoTIFF parameters for Equirectangular</a> * * @since 0.6 diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PseudoPlateCarree.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PseudoPlateCarree.java new file mode 100644 index 0000000..42d8fec --- /dev/null +++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PseudoPlateCarree.java @@ -0,0 +1,71 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.sis.internal.referencing.provider; + +import javax.xml.bind.annotation.XmlTransient; +import org.opengis.parameter.ParameterValueGroup; +import org.opengis.parameter.ParameterDescriptorGroup; +import org.opengis.referencing.operation.MathTransform; +import org.opengis.referencing.operation.MathTransformFactory; +import org.apache.sis.referencing.operation.transform.MathTransforms; + + +/** + * The <cite>"Pseudo Plate Carrée"</cite> pseudo-projection (EPSG:9825). This is only the identity transform; + * even the semi-major and semi-minor axis lengths are fixed to 1. We do not declare that operation method as + * a {@link org.opengis.referencing.operation.Projection} because axis units are degrees. + * + * @author Martin Desruisseaux (Geomatys) + * @version 1.0 + * + * @see Equirectangular + * + * @since 1.0 + * @module + */ +@XmlTransient +public final class PseudoPlateCarree extends AbstractProvider { + /** + * For cross-version compatibility. + */ + private static final long serialVersionUID = -421300231924004828L; + + /** + * The group of all parameters expected by this coordinate operation. + */ + private static final ParameterDescriptorGroup PARAMETERS = builder() + .addName("Pseudo Plate Carree").addIdentifier("9825").createGroup(); + + /** + * Constructs a new provider. + */ + public PseudoPlateCarree() { + super(2, 2, PARAMETERS); + } + + /** + * Creates an Pseudo Plate Carrée projection from the specified group of parameter values. + * + * @param factory ignored. + * @param parameters ignored. + * @return the identity transform. + */ + @Override + public MathTransform createMathTransform(final MathTransformFactory factory, final ParameterValueGroup parameters) { + return MathTransforms.identity(2); + } +} diff --git a/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod b/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod index 879096d..9e2aa85 100644 --- a/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod +++ b/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod @@ -26,6 +26,7 @@ org.apache.sis.internal.referencing.provider.CoordinateFrameRotation3D org.apache.sis.internal.referencing.provider.CoordinateFrameRotation2D org.apache.sis.internal.referencing.provider.Molodensky org.apache.sis.internal.referencing.provider.AbridgedMolodensky +org.apache.sis.internal.referencing.provider.PseudoPlateCarree org.apache.sis.internal.referencing.provider.Equirectangular org.apache.sis.internal.referencing.provider.Mercator1SP org.apache.sis.internal.referencing.provider.Mercator2SP diff --git a/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java b/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java index 14b5cb1..b544c6e 100644 --- a/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java +++ b/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java @@ -75,6 +75,7 @@ public final strictfp class ProvidersTest extends TestCase { Geographic2Dto3D.class, Molodensky.class, AbridgedMolodensky.class, + PseudoPlateCarree.class, Equirectangular.class, Mercator1SP.class, Mercator2SP.class,
