diff --git a/common/src/test/java/org/apache/sedona/common/raster/FunctionsTest.java b/common/src/test/java/org/apache/sedona/common/raster/FunctionsTest.java index 2acb74e0c4..d98441f5ba 100644 --- a/common/src/test/java/org/apache/sedona/common/raster/FunctionsTest.java +++ b/common/src/test/java/org/apache/sedona/common/raster/FunctionsTest.java @@ -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; @@ -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'.