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

Added no_data_value_u64, set_no_data_value_u64, no_data_value_i64 and set_no_data_value_i64 to RasterBand #520

Merged
merged 5 commits into from
Feb 1, 2024

Conversation

metasim
Copy link
Contributor

@metasim metasim commented Feb 1, 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.

Adds RasterBand::no_data_value_u64 and RasterBand::no_data_value_i64, etc.

@metasim metasim requested a review from lnicola February 1, 2024 15:46
@lnicola
Copy link
Member

lnicola commented Feb 1, 2024

Can you resample those to 1x1 and maybe merge them into a single file?

src/raster/rasterband.rs Outdated Show resolved Hide resolved
src/raster/rasterband.rs Outdated Show resolved Hide resolved
@metasim
Copy link
Contributor Author

metasim commented Feb 1, 2024

Just realized I should add the setters too. Not enough coffee this morning...

@lnicola
Copy link
Member

lnicola commented Feb 1, 2024

Good idea, I was actually wondering if there's any way to set it. Might make sense to use a larger value then, like 2^62.

@metasim
Copy link
Contributor Author

metasim commented Feb 1, 2024

Can you resample those to 1x1 and maybe merge them into a single file?

How about a 1x2 so we can have a data value and a no-data value?

CHANGES.md Outdated Show resolved Hide resolved
@metasim
Copy link
Contributor Author

metasim commented Feb 1, 2024

Good idea, I was actually wondering if there's any way to set it. Might make sense to use a larger value then, like 2^62.

I basically neglected to see these

@lnicola
Copy link
Member

lnicola commented Feb 1, 2024

Doesn't seem necessary to me, but sure it doesn't matter. Could come in handy in the future, who knows?

@metasim
Copy link
Contributor Author

metasim commented Feb 1, 2024

Doesn't seem necessary to me...

What are you referring to here? The comment sequence is confusing.

@lnicola
Copy link
Member

lnicola commented Feb 1, 2024

I meant that about the second pixel with a valid value. I don't think it's needed to test these functions, but they could be useful in a simple warping/resampling test.

/// [`GDALDeleteRasterNoDataValue`](https://gdal.org/api/raster_c_api.html#_CPPv427GDALDeleteRasterNoDataValue15GDALRasterBandH)
#[cfg(all(major_ge_3, minor_ge_5))]
pub fn set_no_data_value_i64(&mut self, no_data: Option<i64>) -> Result<()> {
let rv = if let Some(no_data) = no_data {
Copy link
Member

@lnicola lnicola Feb 1, 2024

Choose a reason for hiding this comment

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

Well, isn't this awkward...

Taking an Option seemed like a good idea at the time. Now we have three ways to clear it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I still think there's value in keeping them consistent...

The alternative is to add GDALDeleteRasterNoDataValue

Copy link
Member

Choose a reason for hiding this comment

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

And now I think we should go for that (but in a separate PR).

src/raster/tests.rs Outdated Show resolved Hide resolved
@metasim metasim changed the title Added bindings for GetNoDataValueAsInt64 and GetNoDataValueAsUInt64 Added no_data_value_u64, set_no_data_value_u64, no_data_value_i64 and set_no_data_value_i64 to RasterBand Feb 1, 2024
@lnicola
Copy link
Member

lnicola commented Feb 1, 2024

Please squash at the end!

@metasim metasim merged commit 3c5eb45 into georust:master Feb 1, 2024
9 checks passed
@metasim metasim deleted the feature/nodata-int64 branch February 1, 2024 19:46
@lnicola
Copy link
Member

lnicola commented Feb 1, 2024

🤦

EDIT: nvm, my bad.

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.

None yet

2 participants