Fix a ClassCastException reported on mailing list.
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/SpecializableTransform.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/SpecializableTransform.java
index 1d9e306..d86fa95 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/SpecializableTransform.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/SpecializableTransform.java
@@ -254,7 +254,15 @@
      * we do not know what was the last search result.
      */
     private SubArea locate(final DirectPosition pos) {
-        return (SubArea) RTreeNode.locate(domains, pos);
+        /*
+         * All nodes should be SubArea instances, except in some circumstances the root node.
+         * That root node may returned by `RTreeNode.locate(…)` if given position is inside
+         * the union of all bounding boxes, but not in the bounding box of any specific grid.
+         * In such case the caller will fallback on `DatumShiftGridGroup.interpolateInCell(…)`
+         * which perform a more extensive search for the nearest grid.
+         */
+        final RTreeNode node = RTreeNode.locate(domains, pos);
+        return (node instanceof SubArea) ? (SubArea) node : null;
     }
 
     /**