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 1afd594078 More update for CRS that may be associated ot
`DatumEnsemble` instead of `Datum`. This include an update of GeoAPI snapshot
for the GeoAPI conformance tests.
1afd594078 is described below
commit 1afd5940789342aa0ae9e1faa0e78f47c734c4a3
Author: Martin Desruisseaux <[email protected]>
AuthorDate: Mon Sep 1 18:49:03 2025 +0200
More update for CRS that may be associated ot `DatumEnsemble` instead of
`Datum`.
This include an update of GeoAPI snapshot for the GeoAPI conformance tests.
---
.../apache/sis/io/wkt/GeodeticObjectParser.java | 2 +-
.../main/org/apache/sis/referencing/CommonCRS.java | 93 +++++++++++++++-------
.../sis/referencing/EPSGFactoryFallback.java | 29 +++++--
.../sis/referencing/StandardDefinitions.java | 18 +++--
.../referencing/datum/DefaultGeodeticDatum.java | 4 +-
.../factory/GeodeticAuthorityFactory.java | 2 +-
.../org/apache/sis/referencing/Assertions.java | 2 +-
.../org/apache/sis/referencing/CommonCRSTest.java | 6 +-
.../sis/referencing/EPSGFactoryFallbackTest.java | 12 +--
.../sis/referencing/GeodeticObjectVerifier.java | 7 +-
.../sis/referencing/StandardDefinitionsTest.java | 2 +-
.../report/CoordinateReferenceSystems.java | 2 +-
.../sis/storage/geotiff/reader/CRSBuilder.java | 2 +-
.../apache/sis/storage/netcdf/base/CRSBuilder.java | 2 +-
.../apache/sis/storage/netcdf/base/Convention.java | 2 +-
.../sis/storage/netcdf/base/GridMapping.java | 2 +-
geoapi/snapshot | 2 +-
17 files changed, 124 insertions(+), 65 deletions(-)
diff --git
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/GeodeticObjectParser.java
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/GeodeticObjectParser.java
index 272daf4cea..d60c174674 100644
---
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/GeodeticObjectParser.java
+++
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/GeodeticObjectParser.java
@@ -1196,7 +1196,7 @@ class GeodeticObjectParser extends MathTransformParser
implements Comparator<Coo
}
}
element.close(ignoredElements);
- final var info = new BursaWolfParameters(CommonCRS.WGS84.datum(),
null);
+ final var info = new BursaWolfParameters(CommonCRS.WGS84.datum(true),
null);
info.setValues(values);
return info;
}
diff --git
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/CommonCRS.java
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/CommonCRS.java
index e8a9d1db04..1d33123aca 100644
---
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/CommonCRS.java
+++
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/CommonCRS.java
@@ -76,6 +76,7 @@ import org.apache.sis.system.SystemListener;
import org.apache.sis.system.Modules;
import org.apache.sis.util.OptionalCandidate;
import org.apache.sis.util.ArgumentChecks;
+import org.apache.sis.util.ComparisonMode;
import org.apache.sis.util.Exceptions;
import org.apache.sis.util.Utilities;
import org.apache.sis.util.privy.Constants;
@@ -329,8 +330,8 @@ public enum CommonCRS {
final short geocentric;
/**
- * The EPSG code of the datum. The value is often {@link #geographic} +
2000,
- * but it doesn't have to be always the case.
+ * The EPSG code of the datum or datum ensemble.
+ * The value is often {@link #geographic} + 2000, but it doesn't have to
be always the case.
*/
final short datum;
@@ -462,8 +463,8 @@ public enum CommonCRS {
}
/**
- * Returns the {@code CommonCRS} enumeration value for the datum of the
given CRS.
- * The given CRS shall comply to the following conditions
+ * Returns the {@code CommonCRS} enumeration value for the datum of the
given <abbr>CRS</abbr>.
+ * The given <abbr>CRS</abbr> shall comply to the following conditions
* (otherwise an {@link IllegalArgumentException} is thrown):
*
* <ul>
@@ -472,9 +473,9 @@ public enum CommonCRS {
* with an {@linkplain CRS#getHorizontalComponent horizontal
component}.</li>
* <li>The {@code crs} or the horizontal component of {@code crs} is
associated to a {@link GeodeticDatum}.</li>
* <li>The geodetic reference frame either<ul>
- * <li>has the same EPSG code as one of the {@code CommonCRS}
enumeration values, or</li>
- * <li>has no EPSG code but is {@linkplain
Utilities#equalsIgnoreMetadata equal, ignoring metadata},
- * to the {@link #datum()} value of one of the {@code CommonCRS}
enumeration values.</li>
+ * <li>has the same <abbr>EPSG</abbr> code as one of the {@code
CommonCRS} enumeration values, or</li>
+ * <li>has no <abbr>EPSG</abbr> code but is {@linkplain
Utilities#equalsIgnoreMetadata equal, ignoring metadata},
+ * to the {@link #datum(boolean)} value of one of the {@code
CommonCRS} enumeration values.</li>
* </ul></li>
* </ul>
*
@@ -486,7 +487,7 @@ public enum CommonCRS {
* @return the {@code CommonCRS} value for the geodetic reference frame of
the given CRS.
* @throws IllegalArgumentException if no {@code CommonCRS} value can be
found for the given CRS.
*
- * @see #datum()
+ * @see #datum(boolean)
* @since 0.8
*/
public static CommonCRS forDatum(final CoordinateReferenceSystem crs) {
@@ -533,15 +534,13 @@ public enum CommonCRS {
}
}
for (final CommonCRS c : values()) {
- final boolean filter;
if (epsg != 0) {
- filter = c.datum == epsg;
- } else if (datum != null) {
- filter = Utilities.equalsIgnoreMetadata(c.datum(), datum);
- } else {
- filter = Utilities.equalsIgnoreMetadata(c.datumEnsemble(),
ensemble);
- }
- if (filter) {
+ if (c.datum == epsg) {
+ return c;
+ }
+ } else if (DatumOrEnsemble.isLegacyDatum(c.datumEnsemble(), datum,
ComparisonMode.COMPATIBILITY)
+ || DatumOrEnsemble.isLegacyDatum(ensemble, c.datum(true),
ComparisonMode.COMPATIBILITY))
+ {
return c;
}
}
@@ -658,7 +657,6 @@ public enum CommonCRS {
} catch (FactoryException e) {
failure(this, "geographic", e, geographic);
}
- final GeodeticDatum frame = datum();
/*
* All constants defined in this enumeration use the same
coordinate system, EPSG:6422.
* We will arbitrarily create this CS only for the most frequently
created CRS,
@@ -670,7 +668,7 @@ public enum CommonCRS {
} else {
cs = (EllipsoidalCS)
StandardDefinitions.createCoordinateSystem(StandardDefinitions.ELLIPSOIDAL_2D,
true);
}
- cached = object =
StandardDefinitions.createGeographicCRS(geographic, frame, cs);
+ cached = object =
StandardDefinitions.createGeographicCRS(geographic, datum(false),
datumEnsemble(), cs);
}
return object;
}
@@ -824,9 +822,19 @@ public enum CommonCRS {
return cachedSpherical;
}
+ /**
+ * Returns the datum or datum ensemble associated to this geodetic object.
+ *
+ * @deprecated Replaced by {@link #datum(boolean)} for specifying whether
to include datum ensembles.
+ */
+ @Deprecated(since="1.5", forRemoval=true)
+ public GeodeticDatum datum() {
+ return datum(true);
+ }
+
/**
* Returns the geodetic reference frame associated to this geodetic object.
- * The following table summarizes the datums known to this class,
+ * The following table summarizes the datums or datum ensembles known to
this class,
* together with an enumeration value that can be used for fetching that
datum:
*
* <blockquote><table class="sis">
@@ -842,13 +850,23 @@ public enum CommonCRS {
* <tr><td>World Geodetic System 1984</td>
<td>{@link #WGS84}</td> <td>6326</td></tr>
* </table></blockquote>
*
- * @return the geodetic reference frame associated to this enum, or {@code
null} for a datum ensemble.
+ * Some rows in above table are actually defined as datum ensembles in
version 10 or later of the
+ * <abbr>EPSG</abbr> geodetic dataset. These datum ensembles are listed in
{@link #datumEnsemble()}
+ * and may be returned only if the {@code acceptEnsemble} argument is
{@code true}.
+ * Note that whether a datum is a datum ensemble depends on whether Apache
<abbr>SIS</abbr>
+ * is connected to an <abbr>EPSG</abbr> geodetic dataset and the version
of that dataset.
+ *
+ * @param acceptEnsemble whether to return datum ensemble as a
pseudo-datum.
+ * @return the datum or (optionally) datum ensemble associated to this
enum, or {@code null}
+ * if the result is a datum ensemble and {@code acceptEnsemble} is
{@code false}.
*
* @see #forDatum(CoordinateReferenceSystem)
* @see org.apache.sis.referencing.datum.DefaultGeodeticDatum
+ *
+ * @since 1.5
*/
- public synchronized GeodeticDatum datum() {
- GeodeticDatum object = datum(cached);
+ public synchronized GeodeticDatum datum(final boolean acceptEnsemble) {
+ GeodeticDatum object = getDatumOrEnsemble(cached);
if (object == null) {
final GeodeticAuthorityFactory factory = factory();
if (factory != null) try {
@@ -861,18 +879,35 @@ public enum CommonCRS {
final var pm = primeMeridian();
cached = object = StandardDefinitions.createGeodeticDatum(datum,
ei, pm);
}
+ if (!acceptEnsemble && object instanceof DatumEnsemble<?>) {
+ return null;
+ }
return object;
}
/**
* Returns the datum ensemble associated to this geodetic object.
+ * The following table summarizes the datum ensembles known to this class,
+ * together with an enumeration value that can be used for fetching that
ensemble:
+ *
+ * <blockquote><table class="sis">
+ * <caption>Commonly used datum ensembles</caption>
+ * <tr><th>Name or alias</th> <th>Enum</th>
<th>EPSG</th></tr>
+ * <tr><td>European Terrestrial Reference System 1989</td> <td>{@link
#ETRS89}</td> <td>6258</td></tr>
+ * <tr><td>World Geodetic System 1984</td> <td>{@link
#WGS84}</td> <td>6326</td></tr>
+ * </table></blockquote>
+ *
+ * The exact table content depends on whether Apache <abbr>SIS</abbr> is
connected to an <abbr>EPSG</abbr>
+ * geodetic dataset and the version of that dataset. In some version, a
datum ensemble may be defined as
+ * an ordinary datum.
*
* @return the datum ensemble associated to this enum, or {@code null} if
none.
*
* @since 1.5
*/
public DatumEnsemble<GeodeticDatum> datumEnsemble() {
- return geographic().getDatumEnsemble();
+ final GeodeticDatum object = datum(true);
+ return (object instanceof DatumEnsemble<?>) ?
(DatumEnsemble<GeodeticDatum>) object : null;
}
/**
@@ -958,14 +993,17 @@ public enum CommonCRS {
}
/**
- * Returns the datum associated to the given object, or {@code null} if
none.
+ * Returns the datum or datum ensemble of the given object, or {@code
null} if none.
+ * Datum ensembles are viewed as pseudo-datum. This is necessary for
consistency,
+ * because {@link org.apache.sis.referencing.datum.DefaultDatumEnsemble}
implements
+ * the {@link Datum} interface anyway in the Apache <abbr>SIS</abbr>
implementation.
*/
- private static GeodeticDatum datum(final IdentifiedObject object) {
+ private static GeodeticDatum getDatumOrEnsemble(final IdentifiedObject
object) {
if (object instanceof GeodeticDatum) {
return (GeodeticDatum) object;
}
if (object instanceof GeodeticCRS) {
- return ((GeodeticCRS) object).getDatum();
+ return DatumOrEnsemble.asDatum((GeodeticCRS) object);
}
return null;
}
@@ -1309,7 +1347,8 @@ public enum CommonCRS {
final short crs;
/**
- * The EPSG code for the datum or the resource keys, depending on
{@link #isEPSG} value.
+ * The EPSG code for the datum or datum ensemble if {@link #isEPSG} is
{@code true},
+ * or the resource keys otherwise.
*/
final short datum;
diff --git
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/EPSGFactoryFallback.java
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/EPSGFactoryFallback.java
index 9fc223597c..f34fe59f58 100644
---
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/EPSGFactoryFallback.java
+++
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/EPSGFactoryFallback.java
@@ -52,6 +52,9 @@ import org.apache.sis.setup.InstallationResources;
import org.apache.sis.measure.Latitude;
import org.apache.sis.measure.Units;
+// Specific to the geoapi-3.1 and geoapi-4.0 branches:
+import org.opengis.referencing.datum.DatumEnsemble;
+
// Specific to the geoapi-4.0 branch:
import org.opengis.referencing.crs.GeodeticCRS;
@@ -195,7 +198,8 @@ final class EPSGFactoryFallback extends
GeodeticAuthorityFactory
* Kinds of object created by this factory, as bitmask. Note that objects
* created for {@link #CS} and {@link #AXIS} kinds are currently not
cached.
*/
- private static final int CRS=0x1, DATUM=0x2, ELLIPSOID=0x4,
PRIME_MERIDIAN=0x8, UNIT=0x10, AXIS=0x20, CS=0x40;
+ private static final int CRS=0x1, DATUM=0x2, ENSEMBLE=0x4, ELLIPSOID=0x8,
PRIME_MERIDIAN=0x10,
+ UNIT=0x20, AXIS=0x40, CS=0x80;
/**
* Returns a prime meridian for the given EPSG code.
@@ -221,6 +225,14 @@ final class EPSGFactoryFallback extends
GeodeticAuthorityFactory
return (Datum) predefined(code, DATUM);
}
+ /**
+ * Returns a datum ensemble for the given EPSG code.
+ */
+ @Override
+ public DatumEnsemble<?> createDatumEnsemble(final String code) throws
NoSuchAuthorityCodeException {
+ return (DatumEnsemble<?>) predefined(code, ENSEMBLE);
+ }
+
/**
* Returns a coordinate reference system for the given EPSG code. This
method is invoked
* as a fallback when {@link CRS#forCode(String)} cannot create a CRS for
a given code.
@@ -310,9 +322,9 @@ final class EPSGFactoryFallback extends
GeodeticAuthorityFactory
}
}
/*
- * Cases that we can delegate to `CommonCRS`. That enumeration
have its own cache.
+ * Cases that we can delegate to `CommonCRS`. That enumeration has
its own cache.
*/
- if ((kind & (ELLIPSOID | DATUM | CRS)) != 0) {
+ if ((kind & (ELLIPSOID | DATUM | ENSEMBLE | CRS)) != 0) {
for (final CommonCRS crs : CommonCRS.values()) {
/*
* In a complete EPSG dataset we could have an ambiguity
below because the same code can be used
@@ -320,7 +332,8 @@ final class EPSGFactoryFallback extends
GeodeticAuthorityFactory
* ensured that there is no such collision - see
CommonCRSTest.ensureNoCodeCollision().
*/
if ((kind & ELLIPSOID) != 0 && n == crs.ellipsoid)
return crs.ellipsoid();
- if ((kind & DATUM) != 0 && n == crs.datum)
return crs.datum();
+ if ((kind & DATUM) != 0 && n == crs.datum)
return crs.datum(false);
+ if ((kind & ENSEMBLE) != 0 && n == crs.datum)
return crs.datumEnsemble();
if ((kind & CRS) != 0) {
if (n == crs.geographic) return crs.geographic();
if (n == crs.geocentric) return crs.geocentric();
@@ -343,11 +356,12 @@ final class EPSGFactoryFallback extends
GeodeticAuthorityFactory
return crs.universal(latitude,
TransverseMercator.Zoner.UTM.centralMeridian(zone));
}
}
- if ((kind & (DATUM | CRS)) != 0) {
+ if ((kind & (DATUM | ENSEMBLE | CRS)) != 0) {
for (final CommonCRS.Vertical candidate :
CommonCRS.Vertical.values()) {
if (candidate.isEPSG) {
- if ((kind & DATUM) != 0 && candidate.datum == n)
return candidate.datum();
- if ((kind & CRS) != 0 && candidate.crs == n)
return candidate.crs();
+ if ((kind & DATUM) != 0 && candidate.datum ==
n) return candidate.datum();
+ if ((kind & ENSEMBLE) != 0 && candidate.datum ==
n) return null; // Not yet provided.
+ if ((kind & CRS) != 0 && candidate.crs ==
n) return candidate.crs();
}
}
}
@@ -418,6 +432,7 @@ final class EPSGFactoryFallback extends
GeodeticAuthorityFactory
switch (kind) {
case CRS: return CoordinateReferenceSystem.class;
case DATUM: return Datum.class;
+ case ENSEMBLE: return DatumEnsemble.class;
case ELLIPSOID: return Ellipsoid.class;
case PRIME_MERIDIAN: return PrimeMeridian.class;
case UNIT: return Unit.class;
diff --git
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/StandardDefinitions.java
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/StandardDefinitions.java
index 92fc9c85b7..f2a2c0da46 100644
---
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/StandardDefinitions.java
+++
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/StandardDefinitions.java
@@ -77,6 +77,7 @@ import org.apache.sis.measure.Units;
import static
org.apache.sis.metadata.privy.ReferencingServices.AUTHALIC_RADIUS;
// Specific to the geoapi-3.1 and geoapi-4.0 branches:
+import org.opengis.referencing.datum.DatumEnsemble;
import static org.opengis.referencing.ObjectDomain.DOMAIN_OF_VALIDITY_KEY;
@@ -232,14 +233,17 @@ final class StandardDefinitions {
}
/**
- * Creates a geodetic CRS from hard-coded values for the given code.
+ * Creates a geodetic <abbr>CRS</abbr> from hard-coded values for the
given code.
*
- * @param code the EPSG code.
- * @param datum the geodetic reference frame.
- * @param cs the coordinate system.
- * @return the geographic CRS for the given code.
+ * @param code the EPSG code.
+ * @param datum the geodetic reference frame, or {@code null} if a
datum ensemble is used instead.
+ * @param ensemble the datum ensemble, or {@code null} if none.
+ * @param cs the coordinate system.
+ * @return the geographic <abbr>CRS</abbr> for the given code.
*/
- static GeographicCRS createGeographicCRS(final short code, final
GeodeticDatum datum, final EllipsoidalCS cs) {
+ static GeographicCRS createGeographicCRS(final short code, final
GeodeticDatum datum,
+ final DatumEnsemble<GeodeticDatum> ensemble, final EllipsoidalCS
cs)
+ {
final String name;
boolean world = false;
switch (code) {
@@ -254,7 +258,7 @@ final class StandardDefinitions {
default: throw new AssertionError(code);
}
final Map<String, Object> properties = properties(code, name, null,
world);
- return new DefaultGeographicCRS(properties, datum, null, cs);
+ return new DefaultGeographicCRS(properties, datum, ensemble, cs);
}
/**
diff --git
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
index b9942668e1..d388cce354 100644
---
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
+++
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
@@ -106,7 +106,7 @@ import org.opengis.referencing.datum.DynamicReferenceFrame;
*
* <ol>
* <li>Create a {@code GeodeticDatum} from one of the static convenience
shortcuts listed in
- * {@link org.apache.sis.referencing.CommonCRS#datum()}.</li>
+ * {@link org.apache.sis.referencing.CommonCRS#datum(boolean)}.</li>
* <li>Create a {@code GeodeticDatum} from an identifier in a database by
invoking
* {@link
org.opengis.referencing.datum.DatumAuthorityFactory#createGeodeticDatum(String)}.</li>
* <li>Create a {@code GeodeticDatum} by invoking the {@code
DatumFactory.createGeodeticDatum(…)} method
@@ -132,7 +132,7 @@ import org.opengis.referencing.datum.DynamicReferenceFrame;
*
* @see DefaultEllipsoid
* @see DefaultPrimeMeridian
- * @see org.apache.sis.referencing.CommonCRS#datum()
+ * @see org.apache.sis.referencing.CommonCRS#datum(boolean)
* @see
org.apache.sis.referencing.factory.GeodeticAuthorityFactory#createGeodeticDatum(String)
*
* @since 0.4
diff --git
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java
index 09cd80a83e..4ebc0494f5 100644
---
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java
+++
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java
@@ -640,7 +640,7 @@ public abstract class GeodeticAuthorityFactory extends
AbstractFactory implement
* @throws FactoryException if the object creation failed for some other
reason.
*
* @see org.apache.sis.referencing.datum.DefaultGeodeticDatum
- * @see org.apache.sis.referencing.CommonCRS#datum()
+ * @see org.apache.sis.referencing.CommonCRS#datum(boolean)
*/
public GeodeticDatum createGeodeticDatum(final String code) throws
NoSuchAuthorityCodeException, FactoryException {
return cast(GeodeticDatum.class, createDatum(code), code);
diff --git
a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/Assertions.java
b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/Assertions.java
index 11d2eb31e8..629f83ef94 100644
---
a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/Assertions.java
+++
b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/Assertions.java
@@ -499,7 +499,7 @@ public final class Assertions extends Static {
assertLegacyEquals(expected, actual, null);
}
- private static void assertLegacyEquals(String expected, final String
actual, final String message) {
+ static void assertLegacyEquals(String expected, final String actual, final
String message) {
if (expected != null && actual != null) {
for (int i=0; i < REPLACEMENTS.length;) {
final String oldName = REPLACEMENTS[i++];
diff --git
a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/CommonCRSTest.java
b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/CommonCRSTest.java
index ce8bf97cb0..da24ead89f 100644
---
a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/CommonCRSTest.java
+++
b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/CommonCRSTest.java
@@ -399,8 +399,8 @@ public final class CommonCRSTest extends
EPSGDependentTestCase {
*/
@Test
public void testFormat() {
- Assertions.assertLegacyEquals("World Geodetic System 1984",
String.format("%s", CommonCRS.WGS84.datum()));
- assertTrue(String.format("%S",
CommonCRS.WGS84.datum()).startsWith("WORLD GEODETIC SYSTEM 1984"));
- assertTrue(String.format("%#s",
CommonCRS.WGS84.datum()).endsWith(":6326"));
+ Assertions.assertLegacyEquals("World Geodetic System 1984",
String.format("%s", CommonCRS.WGS84.datum(true)));
+ assertTrue(String.format("%S",
CommonCRS.WGS84.datum(true)).startsWith("WORLD GEODETIC SYSTEM 1984"));
+ assertTrue(String.format("%#s",
CommonCRS.WGS84.datum(true)).endsWith(":6326"));
}
}
diff --git
a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/EPSGFactoryFallbackTest.java
b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/EPSGFactoryFallbackTest.java
index b22c338826..ed618cbfaa 100644
---
a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/EPSGFactoryFallbackTest.java
+++
b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/EPSGFactoryFallbackTest.java
@@ -139,12 +139,12 @@ public final class EPSGFactoryFallbackTest extends
TestCaseWithLogs {
*/
@Test
public void testCreateDatum() throws FactoryException {
- verifyCreateDatum(CommonCRS.WGS84 .datum(), "6326");
- verifyCreateDatum(CommonCRS.WGS72 .datum(), "6322");
- verifyCreateDatum(CommonCRS.NAD83 .datum(), "6269");
- verifyCreateDatum(CommonCRS.NAD27 .datum(), "6267");
- verifyCreateDatum(CommonCRS.ED50 .datum(), "6230");
- verifyCreateDatum(CommonCRS.SPHERE.datum(), "6047");
+ verifyCreateDatum(CommonCRS.WGS84 .datum(true), "6326");
+ verifyCreateDatum(CommonCRS.WGS72 .datum(true), "6322");
+ verifyCreateDatum(CommonCRS.NAD83 .datum(true), "6269");
+ verifyCreateDatum(CommonCRS.NAD27 .datum(true), "6267");
+ verifyCreateDatum(CommonCRS.ED50 .datum(true), "6230");
+ verifyCreateDatum(CommonCRS.SPHERE.datum(true), "6047");
loggings.assertNoUnexpectedLog();
}
diff --git
a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/GeodeticObjectVerifier.java
b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/GeodeticObjectVerifier.java
index dec5d99570..4eee79a3ef 100644
---
a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/GeodeticObjectVerifier.java
+++
b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/GeodeticObjectVerifier.java
@@ -32,6 +32,7 @@ import org.opengis.referencing.cs.CartesianCS;
import org.opengis.referencing.cs.EllipsoidalCS;
import org.opengis.referencing.cs.RangeMeaning;
import org.opengis.referencing.crs.GeodeticCRS;
+import org.apache.sis.referencing.datum.DatumOrEnsemble;
import org.apache.sis.metadata.privy.AxisNames;
import org.apache.sis.measure.Units;
@@ -219,7 +220,7 @@ public final class GeodeticObjectVerifier {
* {@code Extent} element for the world, or
{@code false} if optional.
*/
public static void assertIsWGS84(final GeodeticDatum datum, final boolean
isExtentMandatory) {
- assertEquals("World Geodetic System 1984", datum.getName().getCode(),
"name");
+ Assertions.assertLegacyEquals("World Geodetic System 1984",
datum.getName().getCode(), "name");
assertIsWorld (datum, isExtentMandatory);
assertIsGreenwich(datum.getPrimeMeridian());
assertIsWGS84 (datum.getEllipsoid());
@@ -236,7 +237,7 @@ public final class GeodeticObjectVerifier {
* <td>{@code "WGS 84"}</td></tr>
* <tr><td>{@linkplain GeodeticCRS#getDomains() Domain of validity}</td>
* <td>{@linkplain #assertIsWorld(GeographicBoundingBox) Is world} or
absent</td></tr>
- * <tr><td>{@linkplain GeodeticCRS#getDatum() Datum}</td>
+ * <tr><td>{@linkplain GeodeticCRS#getDatum() Datum} or datum ensemble</td>
* <td>{@linkplain #assertIsWGS84(GeodeticDatum, boolean) Is
WGS84}</td></tr>
* <tr><td>{@linkplain GeodeticCRS#getCoordinateSystem() Coordinate
system}</td>
* <td>{@linkplain #assertIsGeodetic2D(EllipsoidalCS, boolean) Is for
a 2D geodetic CRS}</td></tr>
@@ -251,7 +252,7 @@ public final class GeodeticObjectVerifier {
public static void assertIsWGS84(final GeodeticCRS crs, final boolean
isExtentMandatory, final boolean isRangeMandatory) {
assertEquals("WGS 84", crs.getName().getCode(), "name");
assertIsWorld(crs, isExtentMandatory);
- assertIsWGS84(crs.getDatum(), isExtentMandatory);
+ assertIsWGS84(DatumOrEnsemble.asDatum(crs), isExtentMandatory);
final CoordinateSystem cs = crs.getCoordinateSystem();
assertInstanceOf(EllipsoidalCS.class, cs, "coordinateSystem");
assertIsGeodetic2D((EllipsoidalCS) cs, isRangeMandatory);
diff --git
a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/StandardDefinitionsTest.java
b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/StandardDefinitionsTest.java
index 1e77145a0c..fbd8ed7b39 100644
---
a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/StandardDefinitionsTest.java
+++
b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/StandardDefinitionsTest.java
@@ -175,7 +175,7 @@ public final class StandardDefinitionsTest extends
EPSGDependentTestCase {
case WGS72: compare(HardCodedDatum.WGS72, datum); break;
case SPHERE: compare(HardCodedDatum.SPHERE, datum); break;
}
- final GeographicCRS crs =
StandardDefinitions.createGeographicCRS(e.geographic, datum, cs);
+ final GeographicCRS crs =
StandardDefinitions.createGeographicCRS(e.geographic, datum, null, cs);
Validators.validate(crs);
switch (e) {
case WGS84: compare(HardCodedCRS.WGS84, crs); break;
diff --git
a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/report/CoordinateReferenceSystems.java
b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/report/CoordinateReferenceSystems.java
index 219b9ef155..3e9e807f75 100644
---
a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/report/CoordinateReferenceSystems.java
+++
b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/report/CoordinateReferenceSystems.java
@@ -595,7 +595,7 @@ public final class CoordinateReferenceSystems extends
AuthorityCodesReport {
// because those authority codes need parameters.
row.hasError = false;
row.remark = "Projected";
- ((ByName) row).setup(CommonCRS.WGS84.datum(), unusedDatumMapping);
+ ((ByName) row).setup(CommonCRS.WGS84.datum(true),
unusedDatumMapping);
} else {
row.remark = exception.getLocalizedMessage();
((ByName) row).setup(null, unusedDatumMapping);
diff --git
a/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/reader/CRSBuilder.java
b/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/reader/CRSBuilder.java
index 85983970b5..55ae771737 100644
---
a/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/reader/CRSBuilder.java
+++
b/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/reader/CRSBuilder.java
@@ -916,7 +916,7 @@ public final class CRSBuilder extends
ReferencingFactoryContainer {
if (Utilities.equalsIgnoreMetadata(predefined.ellipsoid(),
ellipsoid) &&
Utilities.equalsIgnoreMetadata(predefined.primeMeridian(), meridian))
{
- return predefined.datum();
+ return predefined.datum(true);
}
} catch (IllegalArgumentException e) {
// Not a name that can be mapped to CommonCRS. Ignore.
diff --git
a/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/base/CRSBuilder.java
b/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/base/CRSBuilder.java
index 5f1ce20493..50c3e33691 100644
---
a/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/base/CRSBuilder.java
+++
b/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/base/CRSBuilder.java
@@ -630,7 +630,7 @@ previous: for (int i = components.size(); --i >= 0;) {
* The predefined CRS is {@link #defaultCRS} or a spherical CRS.
*/
protected final void setDatum(final CommonCRS crs) {
- datum = crs.datum();
+ datum = crs.datum(false);
if (datum == null) {
datumEnsemble = crs.datumEnsemble();
}
diff --git
a/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/base/Convention.java
b/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/base/Convention.java
index a15188b97c..a92a3e8fa5 100644
---
a/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/base/Convention.java
+++
b/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/base/Convention.java
@@ -501,7 +501,7 @@ public class Convention {
*/
final Vector values = node.getAttributeAsVector(name);
if (values == null || values.size() < 3) continue;
- final var bp = new
BursaWolfParameters(CommonCRS.WGS84.datum(), null);
+ final var bp = new
BursaWolfParameters(CommonCRS.WGS84.datum(true), null);
bp.setValues(values.doubleValues());
value = bp;
break;
diff --git
a/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/base/GridMapping.java
b/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/base/GridMapping.java
index 9c8bc924ba..860a60aba9 100644
---
a/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/base/GridMapping.java
+++
b/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/base/GridMapping.java
@@ -426,7 +426,7 @@ final class GridMapping {
}
datum = datumFactory.createGeodeticDatum(properties, ellipsoid,
meridian);
} else {
- datum = defaultDefinitions.datum();
+ datum = defaultDefinitions.datum(false);
if (datum == null) {
ensemble = defaultDefinitions.datumEnsemble();
}
diff --git a/geoapi/snapshot b/geoapi/snapshot
index 87e2b78407..0d2c695d36 160000
--- a/geoapi/snapshot
+++ b/geoapi/snapshot
@@ -1 +1 @@
-Subproject commit 87e2b7840794c465e587c29e59913c942ace37fe
+Subproject commit 0d2c695d36f3f38c5783316b82fc8516326496b0