Martin Desruisseaux created SIS-610:
---------------------------------------

             Summary: GridDerivation.subgrid(…) should accept AOI with less 
dimensions than the grid
                 Key: SIS-610
                 URL: https://issues.apache.org/jira/browse/SIS-610
             Project: Spatial Information Systems
          Issue Type: Improvement
          Components: Coverage
    Affects Versions: 1.4, 1.3, 1.2, 1.1, 1.0
            Reporter: Martin Desruisseaux
            Assignee: Martin Desruisseaux


When an Area Of Interest (AOI) is specified by a call to 
{{GridGeometry.derive().subgrid(…)}}, the current implementation requires that 
the AOI has at least as many dimensions as the original grid, because the 
result of this operation is a grid having the number of dimensions of the 
original grid. The problem is that we sometime have a two-dimensional only AOI 
and nevertheless want to apply it to a three- or four-dimensional grid. Apache 
SIS should be able to modify the {{GridGeometry}} only in the dimensions 
specified by the AOI, and leave the other dimensions unchanged.

As a special case, SIS 1.5 accepts an AOI with less dimensions if all extra 
dimensions have a number of cells equals to 1 (i.e., the grid is a slice). This 
issue is about removing that restriction.

To reproduce (expected behavior is success, current behavior is 
`OperationNotFoundException` between “WGS 84” and “WGS 84 + Ellipsoidal height 
+…”):

{code:java}
private static void testMultidimensionalSlicing() throws Exception {
    var sourceEnv = new GeneralEnvelope(CRS.compound(
            CommonCRS.defaultGeographic(),
            CommonCRS.Vertical.ELLIPSOIDAL.crs(),
            CommonCRS.Temporal.JAVA.crs()
    ));
    sourceEnv.setRange(0, 10, 20);
    sourceEnv.setRange(1, 30, 40);
    sourceEnv.setRange(2, 0, 2);
    sourceEnv.setRange(3, 0, 2);
    var sourceGrid = new GridGeometry(
            new GridExtent(null, new long[4], new long[] { 2, 2, 2, 2 }, false),
            sourceEnv,
            GridOrientation.DISPLAY
    );
    var targetGrid = new GridGeometry(
            new GridExtent(2, 2),
            new Envelope2D(CommonCRS.defaultGeographic(), 10, 30, 10, 10),
            GridOrientation.DISPLAY
    );
    var slice = sourceGrid.derive()
                          .subgrid(targetGrid)
                          .build();
}
{code}




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to