-
Notifications
You must be signed in to change notification settings - Fork 693
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SEDONA-421] Add RS_Clip #1078
[SEDONA-421] Add RS_Clip #1078
Conversation
…n of a new raster
… creation of a new raster" This reverts commit 7edb62b.
// * @param crop Specifies to keep the original extent or not | ||
// * @return A clip Raster with defined ROI by the geometry | ||
// */ | ||
// public static GridCoverage2D clip(GridCoverage2D raster, int band, Geometry geometry, boolean crop) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought to keep it when we can support same arity functions. We can uncomment it and use it. Do let me know if you still want them to be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. You can leave it there.
// this will shrink the extent of the raster to the geometry | ||
Crop cropObject = new Crop(); | ||
ParameterValueGroup parameters = cropObject.getParameters(); | ||
parameters.parameter("Source").setValue(singleBandRaster); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this have to be a single band?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be either single or all bands. How do you want me to implement it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A single band is ok for now.
@@ -69,6 +73,23 @@ public void testSetBandNoDataValueWithEmptyRasterMultipleBand() throws FactoryEx | |||
assertEquals(444, (double) RasterBandAccessors.getBandNoDataValue(grid, 2), 0.1d); | |||
} | |||
|
|||
@Test | |||
public void testClip() throws IOException, FactoryException, TransformException, ParseException { | |||
GridCoverage2D raster = rasterFromGeoTiff(resourceFolder + "raster_geotiff_color/FAA_UTM18N_NAD83.tif"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add tests to try with crop == true
. In addition, please also test if the pixels of a raster are successfully masked.
Did you read the Contributor Guide?
Is this PR related to a JIRA ticket?
[SEDONA-XXX] my subject
.What changes were proposed in this PR?
How was this patch tested?
Did this PR include necessary documentation updates?