-
Notifications
You must be signed in to change notification settings - Fork 96
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
GDAL DEM Processing Routines #456
Conversation
1413e43
to
b8b752c
Compare
@lnicola Thank you for the early feedback. Course corrections earlier rather than laters are definitely helpful. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as resolved.
This comment was marked as resolved.
By the way, if it's in a trait you also get completions for it. Not that I'm proposing this, just wanted to point it out. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
5e11fb9
to
f36c97b
Compare
output_format: Option<String>, | ||
additional_options: CslStringList, | ||
algorithm: Option<DemSlopeAlg>, | ||
zero_for_flat: Option<bool>, |
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'm inclined to say we should avoid Option
for most, if not all of these. I understand that the default might change, but if -zero_for_flat
ever becomes the default, there will be a new -non_zero_for_flat
and we'll have to update the code anyway. That is,
if self.zero_for_flat == Some(true) {
opts.add_string("-zero_for_flat").unwrap();
}
already assumes that the default is false
. algorithm
is probably an exception here, since the default is not documented.
But we can probably change them later, you must be sick of this PR by now.
common_dem_options!(); | ||
|
||
/// Specify the slope computation algorithm. | ||
pub fn with_algorithm(&mut self, algorithm: DemSlopeAlg) -> &mut Self { |
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.
We don't have getters for these, but the common options have them.
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 was oversight, but we're removing getters, right?
src/raster/processing/dem/aspect.rs
Outdated
|
||
/// Render relevant common options into [`CslStringList`] values, as compatible with | ||
/// [`gdal_sys::GDALDEMProcessing`]. | ||
pub fn to_options_list(&self) -> CslStringList { |
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.
Same as for store_common_options_to
, but more user-facing we could return Result<CslStringList>
here and propagate them nicely out of dem_eval
. These are unlikely to fail but might, for example on OOM.
Slight binary size win and fewer reasons for people to yell that we're bad for doing unwrap
(it happens more often than one might think).
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.
And one final question is where to put these. They're currently under Another aspect is that I think the Rust guidelines encourage tall/deep module hierarchies, but with re-exports so that the user only sees shallow ones. |
The rationale for this is two fold:
On your point about I can see arguments against
My intent was the use would How about this: we close the PR as it is (or tweak the |
I agree it's unusual, but many of the GDAL "apps" are already exposed as a library (everything that ends up taking an
My thinking is "I want
That will never get anywhere, so please no 😛. |
|
@@ -22,6 +22,8 @@ | |||
//! * [`topographic_position_index()`] | |||
//! | |||
|
|||
#![deny(missing_docs)] |
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.
👍
bors r=lnicola |
CHANGES.md
if knowledge of this change could be valuable to users.hillshade
color-relief
Extend
and variousFromIterator
implementations toCslStringList
. #457DemCommonOptionsOwner
and inline the fields into the various structs.DemCommonOptions
Option
from aroundDemCommonOptions::compute_edges
andadditional_options
.ConvertDemProcessing
methods to inherent methods onDataset
.DemProcessing
methods to free functions.