Skip to content

Commit

Permalink
Add test for reading raster from raster file
Browse files Browse the repository at this point in the history
  • Loading branch information
iGN5117 committed Aug 2, 2023
1 parent e37d7f8 commit 4d45e1c
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.opengis.referencing.FactoryException;
import org.opengis.referencing.operation.TransformException;

import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
Expand Down Expand Up @@ -114,6 +115,17 @@ public void testPixelAsPointOutOfBounds() throws FactoryException {
assertEquals(expectedMessage, e.getMessage());
}

@Test
public void testPixelAsPointFromRasterFile() throws IOException, TransformException {
GridCoverage2D raster = rasterFromGeoTiff(resourceFolder + "raster/test1.tiff");
Geometry actualPoint = PixelFunctions.getPixelAsPoint(raster, 1, 1);
Coordinate coordinate = actualPoint.getCoordinate();
double expectedX = -13095817.809482181;
double expectedY = 4021262.7487925636;
assertEquals(expectedX, coordinate.getX(), 0.2d);
assertEquals(expectedY, coordinate.getY(), 0.2d);
}

@Test
public void values() throws TransformException {
// The function 'value' is implemented using 'values'.
Expand Down

0 comments on commit 4d45e1c

Please sign in to comment.