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
The following commit(s) were added to refs/heads/geoapi-4.0 by this push: new 1dec837 Changes for consistency with EPSG geodetic dataset 9.9.1. Some EPSG codes have been deprecated. 1dec837 is described below commit 1dec8376a4db55dee19a2a29fca8370808fc62c9 Author: Martin Desruisseaux <martin.desruisse...@geomatys.com> AuthorDate: Thu Sep 23 13:05:34 2021 +0200 Changes for consistency with EPSG geodetic dataset 9.9.1. Some EPSG codes have been deprecated. --- .../main/java/org/apache/sis/referencing/CRS.java | 1 - .../java/org/apache/sis/referencing/CommonCRS.java | 8 +++---- .../sis/referencing/StandardDefinitions.java | 8 +++---- .../factory/GeodeticAuthorityFactory.java | 1 - .../sis/referencing/factory/sql/EPSG_Prepare.sql | 1 + .../java/org/apache/sis/referencing/CRSTest.java | 21 ++++++++++++++++ .../org/apache/sis/referencing/CommonCRSTest.java | 2 +- .../apache/sis/referencing/factory/GIGS2004.java | 28 +++++++++++++++++++++- .../referencing/factory/sql/EPSGFactoryTest.java | 12 ++++++---- 9 files changed, 65 insertions(+), 17 deletions(-) diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java index 1669ab6..55592f6 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java @@ -164,7 +164,6 @@ public final class CRS extends Static { * <tr><td>CRS:27</td> <td>{@link CommonCRS#NAD27 NAD27}</td> <td>Geographic</td> <td>Like EPSG:4267 except for (<var>longitude</var>, <var>latitude</var>) axis order</td></tr> * <tr><td>CRS:83</td> <td>{@link CommonCRS#NAD83 NAD83}</td> <td>Geographic</td> <td>Like EPSG:4269 except for (<var>longitude</var>, <var>latitude</var>) axis order</td></tr> * <tr><td>CRS:84</td> <td>{@link CommonCRS#WGS84 WGS84}</td> <td>Geographic</td> <td>Like EPSG:4326 except for (<var>longitude</var>, <var>latitude</var>) axis order</td></tr> - * <tr><td>EPSG:4047</td> <td>{@link CommonCRS#SPHERE SPHERE}</td> <td>Geographic</td> <td>GRS 1980 Authalic Sphere</td></tr> * <tr><td>EPSG:4230</td> <td>{@link CommonCRS#ED50 ED50}</td> <td>Geographic</td> <td>European Datum 1950</td></tr> * <tr><td>EPSG:4258</td> <td>{@link CommonCRS#ETRS89 ETRS89}</td> <td>Geographic</td> <td>European Terrestrial Reference Frame 1989</td></tr> * <tr><td>EPSG:4267</td> <td>{@link CommonCRS#NAD27 NAD27}</td> <td>Geographic</td> <td>North American Datum 1927</td></tr> diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java index c119ad7..18122a9 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java @@ -278,7 +278,7 @@ public enum CommonCRS { * * <blockquote><table class="compact"> * <caption>GRS1980 properties</caption> - * <tr><th>EPSG identifiers:</th> <td>4019 (<i>datum:</i> 6019, <i>ellipsoid:</i> 7019)</td></tr> + * <tr><th>EPSG identifiers:</th> <td><del>4019</del> (<i>datum:</i> 6019, <i>ellipsoid:</i> 7019)</td></tr> * <tr><th>Primary names:</th> <td>"Unknown datum based upon the GRS 1980 ellipsoid."</td></tr> * <tr><th>Prime meridian:</th> <td>Greenwich</td></tr> * <tr><th>Semi-major axis length:</th> <td>6378137</td></tr> @@ -297,7 +297,7 @@ public enum CommonCRS { * * <blockquote><table class="compact"> * <caption>Sphere properties</caption> - * <tr><th>EPSG identifiers:</th> <td>4047 (<i>datum:</i> 6047, <i>ellipsoid:</i> 7048)</td></tr> + * <tr><th>EPSG identifiers:</th> <td><del>4047</del> (<i>datum:</i> 6047, <i>ellipsoid:</i> 7048)</td></tr> * <tr><th>Primary names:</th> <td>"Unspecified datum based upon the GRS 1980 Authalic Sphere"</td></tr> * <tr><th>Prime meridian:</th> <td>Greenwich</td></tr> * <tr><th>Semi-major axis length:</th> <td>6371007</td></tr> @@ -622,8 +622,8 @@ public enum CommonCRS { * <tr><td>ETRS89</td> <td>{@link #ETRS89}</td> <td>4258</td></tr> * <tr><td>NAD27</td> <td>{@link #NAD27}</td> <td>4267</td></tr> * <tr><td>NAD83</td> <td>{@link #NAD83}</td> <td>4269</td></tr> - * <tr><td>GRS 1980</td> <td>{@link #GRS1980}</td><td>4019</td></tr> - * <tr><td>GRS 1980 Authalic Sphere</td> <td>{@link #SPHERE}</td> <td>4047</td></tr> + * <tr><td>GRS 1980</td> <td>{@link #GRS1980}</td><td><del>4019</del></td></tr> + * <tr><td>GRS 1980 Authalic Sphere</td> <td>{@link #SPHERE}</td> <td><del>4047</del></td></tr> * <tr><td>WGS 72</td> <td>{@link #WGS72}</td> <td>4322</td></tr> * <tr><td>WGS 84</td> <td>{@link #WGS84}</td> <td>4326</td></tr> * </table></blockquote> diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardDefinitions.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardDefinitions.java index 2da050b..0607a10 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardDefinitions.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardDefinitions.java @@ -338,10 +338,10 @@ final class StandardDefinitions { int dim = 2; // Number of dimension, default to 2. short axisCode; // Code of first axis + dim (or code after the last axis). switch (code) { - case ELLIPSOIDAL_2D: name = "Ellipsoidal 2D"; type = 2; axisCode = 108; break; - case ELLIPSOIDAL_3D: name = "Ellipsoidal 3D"; type = 2; dim = 3; axisCode = 111; break; - case SPHERICAL: name = "Spherical"; type = 1; dim = 3; axisCode = 63; break; - case EARTH_CENTRED: name = "Earth centred"; dim = 3; axisCode = 118; break; + case ELLIPSOIDAL_2D: name = "Ellipsoidal 2D"; type = 2; axisCode = 108; break; + case ELLIPSOIDAL_3D: name = "Ellipsoidal 3D"; type = 2; dim = 3; axisCode = 111; break; + case SPHERICAL: name = "Spherical"; type = 1; dim = 3; axisCode = 63; break; + case EARTH_CENTRED: name = "Cartesian 3D (geocentric)"; dim = 3; axisCode = 118; break; case CARTESIAN_2D: name = "Cartesian 2D"; axisCode = 3; break; case UPS_NORTH: name = "Cartesian 2D for UPS north"; axisCode = 1067; break; case UPS_SOUTH: name = "Cartesian 2D for UPS south"; axisCode = 1059; break; diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java index 0a3712d..92f2262 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java @@ -257,7 +257,6 @@ public abstract class GeodeticAuthorityFactory extends AbstractFactory implement * <tr><td>EPSG:4230</td> <td>Geographic</td> <td>European Datum 1950</td></tr> * <tr><td>EPSG:4258</td> <td>Geographic</td> <td>European Terrestrial Reference Frame 1989</td></tr> * <tr><td>EPSG:4937</td> <td>Geographic 3D</td> <td>European Terrestrial Reference Frame 1989</td></tr> - * <tr><td>EPSG:4047</td> <td>Geographic</td> <td>GRS 1980 Authalic Sphere</td></tr> * </table></div> * * <h4>Default implementation</h4> diff --git a/core/sis-referencing/src/main/resources/org/apache/sis/referencing/factory/sql/EPSG_Prepare.sql b/core/sis-referencing/src/main/resources/org/apache/sis/referencing/factory/sql/EPSG_Prepare.sql index fcb50fb..563d5d2 100644 --- a/core/sis-referencing/src/main/resources/org/apache/sis/referencing/factory/sql/EPSG_Prepare.sql +++ b/core/sis-referencing/src/main/resources/org/apache/sis/referencing/factory/sql/EPSG_Prepare.sql @@ -16,6 +16,7 @@ CREATE TYPE epsg_cs_kind AS ENUM ('ellipsoidal', 'spherical', 'Cartesian', 'v CREATE TYPE epsg_table_name AS ENUM ('Alias', 'Area', + 'AxisName', 'Change', 'Coordinate Axis', 'Coordinate Axis Name', diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java index 2826b1e..02722f4 100644 --- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java +++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java @@ -19,6 +19,7 @@ package org.apache.sis.referencing; import java.util.Map; import java.util.HashMap; import java.util.Arrays; +import org.apache.sis.internal.system.Loggers; import org.opengis.util.FactoryException; import org.opengis.referencing.NoSuchAuthorityCodeException; import org.opengis.referencing.crs.CoordinateReferenceSystem; @@ -38,9 +39,12 @@ import org.apache.sis.util.Utilities; import org.apache.sis.referencing.operation.HardCodedConversions; import org.apache.sis.referencing.crs.HardCodedCRS; import org.apache.sis.referencing.cs.HardCodedCS; +import org.apache.sis.test.LoggingWatcher; import org.apache.sis.test.DependsOnMethod; import org.apache.sis.test.DependsOn; import org.apache.sis.test.TestCase; +import org.junit.After; +import org.junit.Rule; import org.junit.Test; import static org.apache.sis.test.Assert.*; @@ -61,6 +65,21 @@ import static org.apache.sis.test.Assert.*; }) public final strictfp class CRSTest extends TestCase { /** + * A JUnit {@link Rule} for listening to log events. This field is public because JUnit requires us to + * do so, but should be considered as an implementation details (it should have been a private field). + */ + @Rule + public final LoggingWatcher loggings = new LoggingWatcher(Loggers.CRS_FACTORY); + + /** + * Verifies that no unexpected warning has been emitted in any test defined in this class. + */ + @After + public void assertNoUnexpectedLog() { + loggings.assertNoUnexpectedLog(); + } + + /** * Asserts that the result of {@link CRS#forCode(String)} is the given CRS. */ private static void verifyForCode(final SingleCRS expected, final String code) throws FactoryException { @@ -100,6 +119,8 @@ public final strictfp class CRSTest extends TestCase { verifyForCode(CommonCRS.WGS84 .universal(-40, 2), "EPSG:32731"); verifyForCode(CommonCRS.Vertical.MEAN_SEA_LEVEL.crs(), "EPSG:5714"); verifyForCode(CommonCRS.Vertical.DEPTH.crs(), "EPSG:5715"); + + loggings.skipNextLogIfContains("EPSG:4047"); // No longer supported by EPSG. } /** diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java index 7b84e2f..547d069 100644 --- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java +++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java @@ -186,7 +186,7 @@ public final strictfp class CommonCRSTest extends TestCase { final CoordinateSystem cs = crs.getCoordinateSystem(); final String name = cs.getName().getCode(); - assertTrue(name, name.startsWith("Earth centred")); + assertTrue(name, name.startsWith("Cartesian 3D")); assertEquals("dimension", 3, cs.getDimension()); assertAxisDirectionsEqual(name, cs, AxisDirection.GEOCENTRIC_X, AxisDirection.GEOCENTRIC_Y, AxisDirection.GEOCENTRIC_Z); diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2004.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2004.java index f5dd2b9..ff26494 100644 --- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2004.java +++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2004.java @@ -45,7 +45,7 @@ import org.apache.sis.test.LoggingWatcher; * package-private methods in {@link ConcurrentAuthorityFactory}, and for keeping all GIGS tests together.</div> * * @author Martin Desruisseaux (Geomatys) - * @version 0.7 + * @version 1.1 * @since 0.7 * @module */ @@ -131,6 +131,32 @@ public final strictfp class GIGS2004 extends org.opengis.test.referencing.gigs.G } /** + * Overrides the GeoAPI test for verifying the log messages emitted during the construction of deprecated objects. + * + * @throws FactoryException if an error occurred while creating the object. + */ + @Test + @Override + public void testPadang() throws FactoryException { + super.testPadang(); + loggings.assertNextLogContains("EPSG:6280"); // Datum + loggings.assertNextLogContains("EPSG:4280"); // CRS + } + + /** + * Overrides the GeoAPI test for verifying the log messages emitted during the construction of deprecated objects. + * + * @throws FactoryException if an error occurred while creating the object. + */ + @Test + @Override + public void testPadang_Jakarta() throws FactoryException { + super.testPadang_Jakarta(); + loggings.assertNextLogContains("EPSG:6808"); // Datum + loggings.assertNextLogContains("EPSG:4808"); // CRS + } + + /** * Verifies that no unexpected warning has been emitted in this test. */ @After diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGFactoryTest.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGFactoryTest.java index d2bbcd2..644d577 100644 --- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGFactoryTest.java +++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGFactoryTest.java @@ -79,7 +79,7 @@ import static org.apache.sis.test.ReferencingAssert.*; * * @author Martin Desruisseaux (IRD, Geomatys) * @author Vadim Semenov - * @version 1.0 + * @version 1.1 * @since 0.7 * @module */ @@ -534,6 +534,8 @@ public final strictfp class EPSGFactoryTest extends TestCase { assertEpsgNameAndIdentifierEqual("World Equidistant Cylindrical (Sphere)", 4088, replacement); assertEpsgNameAndIdentifierEqual("Equidistant Cylindrical (Spherical)", 1029, replacement.getConversionFromBase().getMethod()); + loggings.assertNextLogContains("EPSG:4088", "4087"); // Coordinate Reference System 4088 has been replaced by 4087 + assertSame("Base CRS", crs.getBaseCRS(), replacement.getBaseCRS()); assertSame("Coordinate system", crs.getCoordinateSystem(), replacement.getCoordinateSystem()); @@ -731,10 +733,10 @@ public final strictfp class EPSGFactoryTest extends TestCase { // Tests the fusion of all types if (RUN_EXTENSIVE_TESTS) { final Set<String> all = factory.getAuthorityCodes(IdentifiedObject.class); - assertTrue (all.containsAll(crs)); - assertTrue (all.containsAll(datum)); - assertTrue (all.containsAll(operations)); - assertFalse(all.containsAll(units)); // They are not IdentifiedObjects. + assertTrue(all.containsAll(crs)); + assertTrue(all.containsAll(datum)); + assertTrue(all.containsAll(operations)); + assertTrue(all.containsAll(units)); } // Try a dummy type.