-
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
Allow reading block-size of Rasters #67
Conversation
1. implemented GetBlockSize 2. added feature flag "gdal_2_2" to enable recent GDAL functions. 3. implemented GetActualBlockSize (behind "gdal_2_2" flag)
Thanks for your contribution, @rmanoka! Code looks good to me. Would you mind adding some tests for the new functions and resolve the conflicting files? |
@pka Sure, I'll add tests and resolve There are a couple of minor issue with #68 that has been merged recently:
Any ideas? |
Actually, the GDAL docs say it already yields an array of block-size dimensions; so the user only needs to use |
+ added `x_size()`, `y_size()`, and `size()` to `RasterBand` + added tests
@@ -42,6 +40,31 @@ impl <'a> RasterBand<'a> { | |||
(size_x as usize, size_y as usize) | |||
} | |||
|
|||
/// Get x-size of the band | |||
pub fn x_size(&self) -> usize { | |||
let out; |
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.
Nit: let out = unsafe { gdal_sys::GDALGetRasterBandXSize(self.c_rasterband); }
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.
Looks good to me, and the Travis failure seems unrelated.
Ping @pka? |
|
Works for me. Let's wait for the |
This PR allows efficient streaming of raster by reading (using already existing
read_as
) along block boundaries. To get block size, callblock_size
on aRasterBand
.Additionally, we also add feature flag
gdal_2_2
that enables the corresponding feature ingdal-sys
crate to pull in features from GDAL >= 2.2. Using this, we provideactual_block_size
function behind this feature gate to be used if required.List of what is implemented: