-
Notifications
You must be signed in to change notification settings - Fork 94
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
Unified raster creation options over CplStringList
.
#519
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
use crate::cpl::CslStringList; | ||
|
||
/// Key/value pairs of options for passing driver-specific creation flags to | ||
/// [`Driver::create_with_band_type_with_options`](crate::Driver::create_with_band_type_with_options`). | ||
/// | ||
/// See `papszOptions` in [GDAL's `Create(...)` API documentation](https://gdal.org/api/gdaldriver_cpp.html#_CPPv4N10GDALDriver6CreateEPKciii12GDALDataType12CSLConstList). | ||
pub type RasterCreationOptions = CslStringList; | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -578,23 +578,12 @@ impl<'a> RasterBand<'a> { | |
/// ```rust, no_run | ||
/// # fn main() -> gdal::errors::Result<()> { | ||
/// use gdal::DriverManager; | ||
/// use gdal::raster::{Buffer, RasterCreationOption}; | ||
/// use gdal::raster::{Buffer, RasterCreationOptions }; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit:
|
||
/// | ||
/// let driver = DriverManager::get_driver_by_name("GTiff").unwrap(); | ||
/// let options = [ | ||
/// RasterCreationOption { | ||
/// key: "TILED", | ||
/// value: "YES", | ||
/// }, | ||
/// RasterCreationOption { | ||
/// key: "BLOCKXSIZE", | ||
/// value: "16", | ||
/// }, | ||
/// RasterCreationOption { | ||
/// key: "BLOCKYSIZE", | ||
/// value: "16", | ||
/// }, | ||
/// ]; | ||
/// let options = RasterCreationOptions::from_iter([ | ||
/// "TILED=YES", "BLOCKXSIZE=16", "BLOCKYSIZE=16" | ||
/// ]); | ||
/// let dataset = driver | ||
/// .create_with_band_type_with_options::<u16, _>( | ||
/// "/vsimem/test_write_block.tif", | ||
|
@@ -1434,7 +1423,7 @@ impl Debug for ColorEntry { | |
/// | ||
/// // Create in-memory copy to mutate | ||
/// let mem_driver = DriverManager::get_driver_by_name("MEM")?; | ||
/// let ds = ds.create_copy(&mem_driver, "<mem>", &[])?; | ||
/// let ds = ds.create_copy(&mem_driver, "<mem>", &Default::default())?; | ||
/// let mut band = ds.rasterband(1)?; | ||
/// assert!(band.color_table().is_none()); | ||
/// | ||
|
@@ -1448,7 +1437,7 @@ impl Debug for ColorEntry { | |
/// | ||
/// // Render a PNG | ||
/// let png_driver = DriverManager::get_driver_by_name("PNG")?; | ||
/// ds.create_copy(&png_driver, "/tmp/labels.png", &[])?; | ||
/// ds.create_copy(&png_driver, "/tmp/labels.png", &Default::default())?; | ||
/// | ||
/// # Ok(()) | ||
/// # } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Not 100% sure if
a) A type alias is a good idea
b) It should be in a separate file
Rationale:
a) If we ever needed to convert it into a newtype (to add creation-specific methods like
validate
, it's less breaking. Also, it's easy to get create options and other options confused, so this makes it a bit more clear.b) Putting a single type in
mod.rs
feels unbalanced.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 should probably re-export it from the parent module, so not breaking.
There might be more 🙂.
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 is:
https://github.com/georust/gdal/pull/519/files#diff-eb172c9758a6ca0ee77f152d6a8c864de3a68ea11439bb26fa33ea60d3490155R78