-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added rasterband.rs and moved all band functions from dataset.rs to r…
…asterband.rs. Added more rasterband functions and tests.
- Loading branch information
Showing
6 changed files
with
276 additions
and
104 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
extern crate gdal; | ||
|
||
use std::path::Path; | ||
use gdal::raster::{Dataset, RasterBand}; | ||
use gdal::metadata::Metadata; | ||
|
||
fn main() { | ||
|
||
let path = Path::new("./fixtures/tinymarble.png"); | ||
let dataset = Dataset::open(path).unwrap(); | ||
println!("dataset description: {:?}", dataset.get_description()); | ||
|
||
let rasterband: RasterBand = dataset.get_rasterband(1).unwrap(); | ||
println!("rasterband description: {:?}", rasterband.get_description()); | ||
println!("rasterband no_data_value: {:?}", rasterband.get_no_data_value()); | ||
println!("rasterband type: {:?}", rasterband.get_band_type()); | ||
println!("rasterband scale: {:?}", rasterband.get_scale()); | ||
println!("rasterband offset: {:?}", rasterband.get_offset()); | ||
let rv = rasterband.read_as::<u8>( | ||
(20, 30), | ||
(2, 3), | ||
(2, 3) | ||
); | ||
println!("{:?}", rv.data); | ||
} |
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
Oops, something went wrong.