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 ability to create and edit color tables. #314

Merged
merged 8 commits into from Oct 5, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Expand Up @@ -8,6 +8,9 @@ on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

env:
RUST_BACKTRACE: 1

jobs:
gdal_35:
name: "ci gdal-35"
Expand Down
5 changes: 5 additions & 0 deletions CHANGES.md
Expand Up @@ -27,6 +27,11 @@

- <https://github.com/georust/gdal/pull/311>

- Added ability to set color table for bands with palette color interpretation.
Added ability to create a color ramp (interpolated) color table.

- <https://github.com/georust/gdal/pull/314>

## 0.13

- Add prebuild bindings for GDAL 3.5
Expand Down
Binary file added fixtures/labels.tif
Binary file not shown.
9 changes: 8 additions & 1 deletion src/dataset.rs
Expand Up @@ -19,10 +19,10 @@ use crate::{
Driver, Metadata,
};

use gdal_sys::OGRGeometryH;
use gdal_sys::{
self, CPLErr, GDALAccess, GDALDatasetH, GDALMajorObjectH, OGRErr, OGRLayerH, OGRwkbGeometryType,
};
use gdal_sys::{GDALFlushCache, OGRGeometryH};
use libc::{c_double, c_int, c_uint};

#[cfg(all(major_ge_3, minor_ge_1))]
Expand Down Expand Up @@ -400,6 +400,13 @@ impl Dataset {
Ok(Dataset { c_dataset })
}

/// Flush all write cached data to disk.
///
/// See [`GDALFlushCache`].
pub fn flush_cache(&self) {
metasim marked this conversation as resolved.
Show resolved Hide resolved
unsafe { GDALFlushCache(self.c_dataset) }
}

metasim marked this conversation as resolved.
Show resolved Hide resolved
/// Creates a new Dataset by wrapping a C pointer
///
/// # Safety
Expand Down