Skip to content
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

Add Rasterband::set_statistics #529

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

netthier
Copy link
Contributor

@netthier netthier commented Apr 19, 2024

  • I agree to follow the project's code of conduct.
  • I added an entry to CHANGES.md if knowledge of this change could be valuable to users.

This PR adds safe bindings for https://docs.rs/gdal-sys/latest/gdal_sys/fn.GDALSetRasterStatistics.html (https://gdal.org/api/gdalrasterband_cpp.html#_CPPv4N14GDALRasterBand13SetStatisticsEdddd).
I also fixed up the docs for get_statistics where a backtick was missing.

@netthier netthier force-pushed the raster-set-statistics branch from c01e3a7 to 9a4fc03 Compare April 19, 2024 12:10
@netthier
Copy link
Contributor Author

It could maybe make sense to have the method take StatisticsAll instead.

Signed-off-by: netthier <lp@senselabs.de>
Signed-off-by: netthier <lp@senselabs.de>
@netthier netthier force-pushed the raster-set-statistics branch from 9a4fc03 to ecaf51a Compare April 24, 2024 09:58
Copy link
Contributor

@ChristianBeilschmidt ChristianBeilschmidt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, maybe you can add your suggestion.

/// # Notes
/// See also:
/// [`GDALSetRasterStatistics`](https://gdal.org/api/gdalrasterband_cpp.html#_CPPv4N14GDALRasterBand13SetStatisticsEdddd)
pub fn set_statistics(&mut self, min: f64, max: f64, mean: f64, std_dev: f64) -> Result<()> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could use StatisticsAll so that we can avoid having for floats being submitted. It is more verbose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants