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 cc3e285243c92b9bdd8184492d1411ca0c10aab7 Author: Martin Desruisseaux <martin.desruisse...@geomatys.com> AuthorDate: Fri Feb 28 12:59:47 2025 +0100 Vertical resolution was fetched from the old dimension when z is not the third axis. --- .../main/org/apache/sis/storage/geotiff/writer/GeoEncoder.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/writer/GeoEncoder.java b/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/writer/GeoEncoder.java index a0d4db0378..7337852ab3 100644 --- a/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/writer/GeoEncoder.java +++ b/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/writer/GeoEncoder.java @@ -40,6 +40,7 @@ import org.opengis.referencing.cs.AxisDirection; import org.opengis.referencing.cs.CoordinateSystem; import org.opengis.referencing.cs.CartesianCS; import org.opengis.referencing.cs.EllipsoidalCS; +import org.opengis.referencing.cs.VerticalCS; import org.opengis.referencing.datum.Ellipsoid; import org.opengis.referencing.datum.PrimeMeridian; import org.opengis.referencing.datum.GeodeticDatum; @@ -294,7 +295,7 @@ public final class GeoEncoder { final CoordinateReferenceSystem fullCRS = grid.getCoordinateReferenceSystem(); final VerticalCRS vertical = CRS.getVerticalComponent(fullCRS, true); if (vertical != null) { - final CoordinateSystem cs = vertical.getCoordinateSystem(); + final VerticalCS cs = vertical.getCoordinateSystem(); final int verticalDimension = AxisDirections.indexOfColinear(fullCRS.getCoordinateSystem(), cs); if (verticalDimension >= 0 && Arrays.binarySearch(dimensions, verticalDimension) < 0) { writeCRS(vertical); @@ -311,7 +312,7 @@ public final class GeoEncoder { case MATRIX_SIZE-1: s = more.getNumCol() - 1; break; // Translation. } // Copy the rows of the third dimension. - gridToCRS.setElement(BIDIMENSIONAL, i, more.getElement(BIDIMENSIONAL, s)); + gridToCRS.setElement(BIDIMENSIONAL, i, more.getElement(verticalDimension, s)); } } }