-
Notifications
You must be signed in to change notification settings - Fork 3
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
Adds overlapRasterGroupMetrics function #270
Conversation
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.
Thanks for this PR @avmey. I think it's a good addition. A couple of small changes requested.
/** Raster to overlap, keyed by class ID, use empty array if overlapArea operation */ | ||
featuresByClass: Record<string, Georaster>; |
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.
Should this extra part of comment be dropped? "use empty array if overlapArea operation". Maybe it was copied over from the other function.
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.
Removing that last part, it was an artifact as you expected
featuresByClass: | ||
| Record<string, Feature<Polygon>[]> | ||
| Record<string, Georaster>; |
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.
My understanding is that overlapGroupMetrics
can now be called with either features or a raster. That seems to be the main reason to have mixed mixed vector and raster into the same typings? If so, would you be willing to write a test that this function can now handle either input?
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.
That is the case, yeah. I did keep the name the same and added the extra typing so there wouldn't be a breaking change. It's handling of raster input is tested in overlapGroupMetrics.test.ts
, and I can add a test of the feature[] input.
* Adds overlapRasterGroupMetrics function * Tests overlapGroupMetrics can recieve feature[]
Functions calculating "grouped" metrics exist in the gp library for overlapFeatures and overlapArea, but not for raster overlap analysis.
Adds a corresponding
overlapRasterGroupMetrics
function to go along with theoverlapAreaGroupMetrics
andoverlapFeaturesGroupMetrics
functions, bringing this functionality from in-project code in the Belize reports.Experimental release
6.1.3-experimental-rasterGroupMetrics.0
was tested in the Belize reports and confirmed working.