james-willis commented on code in PR #3114:
URL: https://github.com/apache/sedona/pull/3114#discussion_r3616849127
##########
common/src/main/java/org/apache/sedona/common/raster/Rasterization.java:
##########
@@ -85,6 +99,23 @@ protected static List<Object> rasterize(
return objects;
}
+ /**
+ * Fills every pixel of the freshly-allocated raster with the background
value, so pixels never
+ * covered by the geometry read back as that value instead of the allocation
default of 0. A null
+ * or zero background keeps the zero-initialized allocation as-is.
+ */
+ private static void fillBackground(WritableRaster writableRaster, Double
backgroundValue) {
+ if (backgroundValue == null || backgroundValue == 0) {
+ return;
+ }
+ int width = writableRaster.getWidth();
+ double[] row = new double[width];
+ Arrays.fill(row, backgroundValue);
Review Comment:
I would vote for rejecting values that the pixel type cannot represent. I do
not like permissive type coercion, it is hard for users to debug.
--
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]