furqaankhan commented on code in PR #1121:
URL: https://github.com/apache/sedona/pull/1121#discussion_r1393036192


##########
common/src/main/java/org/apache/sedona/common/raster/PixelFunctions.java:
##########
@@ -41,6 +42,32 @@ public static Double value(GridCoverage2D rasterGeom, 
Geometry geometry, int ban
         return values(rasterGeom, Collections.singletonList(geometry), 
band).get(0);
     }
 
+    public static Double value(GridCoverage2D rasterGeom, int colX, int rowY, 
int band) throws TransformException {
+        int numBands = rasterGeom.getNumSampleDimensions();
+        if (band < 1 || band > numBands) {
+            // Invalid band index. Return nulls.
+            return null;
+        }

Review Comment:
   Please use the RasterUtil.ensureBand method for this



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to