This is an automated email from the ASF dual-hosted git repository.

asf-gitbox-commits pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git

commit 5a027d23dc5af0c885f02c5ad27c592b89337c4b
Author: Martin Desruisseaux <[email protected]>
AuthorDate: Tue Oct 20 01:30:56 2026 +0200

    Avoid an exception about mismatched datum when there is no datum shift 
information.
---
 .../apache/sis/coverage/grid/CoordinateOperationFinder.java    |  5 +++--
 .../referencing/operation/DefaultConcatenatedOperation.java    | 10 ++++++++--
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git 
a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/CoordinateOperationFinder.java
 
b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/CoordinateOperationFinder.java
index 8163f2a9fa..3d57886698 100644
--- 
a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/CoordinateOperationFinder.java
+++ 
b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/CoordinateOperationFinder.java
@@ -339,9 +339,10 @@ final class CoordinateOperationFinder extends 
CoordinateOperationContext {
                 /*
                  * Unconditionally create the operation even if the CRS are 
equivalent. A non-null operation
                  * trigs the check for wraparound axes, which is necessary 
even if the transform is identity.
+                 * Note that the envelope may be undefined.
                  */
-                addAreaOfInterest(source.envelope);
-                addAreaOfInterest(target.envelope);
+                if (source.isDefined(GridGeometry.ENVELOPE)) 
addAreaOfInterest(source.getEnvelope());
+                if (target.isDefined(GridGeometry.ENVELOPE)) 
addAreaOfInterest(target.getEnvelope());
                 changeOfCRS = 
CRS.findOperation(source.getCoordinateMetadata(), 
target.getCoordinateMetadata(), this);
             } catch (BackingStoreException e) {
                 throw e.unwrapOrRethrow(TransformException.class);
diff --git 
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultConcatenatedOperation.java
 
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultConcatenatedOperation.java
index 2e882fecf1..8006da489e 100644
--- 
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultConcatenatedOperation.java
+++ 
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultConcatenatedOperation.java
@@ -302,8 +302,14 @@ final class DefaultConcatenatedOperation extends 
AbstractCoordinateOperation imp
                 final var nested = ((ConcatenatedOperation) 
op).getOperations().toArray(CoordinateOperation[]::new);
                 previous = initialize(properties, nested, flattened, null, 
previous, false, setAccuracy);
             } else {
-                // Note: operation (source, target) may be in reverse order, 
but it should be taken as metadata.
-                if (!step.isIdentity()) {
+                /*
+                 * We can skip identity transforms only if the operation is a 
conversion.
+                 * We do not want to skip the tests for transformations, 
because there is
+                 * may a change of datum and we want to keep the positional 
accuracy metadata.
+                 *
+                 * Note: operation (source, target) may be in reverse order, 
but it should be taken as metadata.
+                 */
+                if (!(step.isIdentity() && step instanceof Conversion)) {
                     flattened.add(op);
                 }
                 previous = target;          // For next iteration cycle.

Reply via email to