Skip to content

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.

@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