iGN5117 commented on code in PR #973:
URL: https://github.com/apache/sedona/pull/973#discussion_r1296018941
##########
common/src/main/java/org/apache/sedona/common/raster/GeometryFunctions.java:
##########
@@ -61,6 +63,70 @@ public static Geometry convexHull(GridCoverage2D raster)
throws FactoryException
return geometryFactory.createPolygon(new Coordinate[] {coordOne,
coordTwo, coordThree, coordFour, coordOne});
}
+ public static Geometry minConvexHull(GridCoverage2D raster, Integer band)
throws FactoryException, TransformException {
+ boolean allBands = band == null;
+ if (!allBands) ensureSafeBand(raster, band);
+ int width = RasterAccessors.getWidth(raster), height =
RasterAccessors.getHeight(raster), srid = RasterAccessors.srid(raster);
+ int minX = Integer.MAX_VALUE, maxX = Integer.MIN_VALUE, minY =
Integer.MAX_VALUE, maxY = Integer.MIN_VALUE;
+ for (int j = 0; j < height; j++) {
+ for (int i = 0; i < width; i++) {
+ // get the value of the raster at the coordinates i, j
+ //if value is not no data, update variables to track minX,
maxX, minY, maxY
+ GridCoordinates2D currGridCoordinate = new
GridCoordinates2D(i, j);
+ double[] bandPixelValues = raster.evaluate(currGridCoordinate,
(double[]) null);
+ if (allBands) {
+ for (int currBand = 1; currBand <=
RasterAccessors.numBands(raster); currBand++) {
+ double currBandValue = bandPixelValues[currBand - 1];
+ Double bandNoDataValue =
RasterBandAccessors.getBandNoDataValue(raster, currBand);
+ if ((bandNoDataValue == null) || currBandValue !=
bandNoDataValue) {
Review Comment:
Yes, by multiple bands I mean all bands, we do not have an option of
supporting a subset of all bands. We either do 1 band or all bands
--
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]