-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
637 additions
and
738 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[alias] | ||
# Run doctests, displaying compiler output | ||
# doc-test-output: Run doctests, displaying compiler output | ||
dto = "test --doc -- --show-output" | ||
# Run clippy, raising warnings to errors | ||
nowarn = "clippy --all-targets -- -D warnings" |
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 |
---|---|---|
@@ -1,3 +1,12 @@ | ||
<PAMDataset> | ||
<SRS dataAxisToSRSAxisMapping="2,1">GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AXIS["Latitude",NORTH],AXIS["Longitude",EAST],AUTHORITY["EPSG","4326"]]</SRS> | ||
<PAMRasterBand band="1"> | ||
<Metadata> | ||
<MDI key="STATISTICS_MAXIMUM">255</MDI> | ||
<MDI key="STATISTICS_MEAN">68.4716</MDI> | ||
<MDI key="STATISTICS_MINIMUM">0</MDI> | ||
<MDI key="STATISTICS_STDDEV">83.68444773935</MDI> | ||
<MDI key="STATISTICS_VALID_PERCENT">100</MDI> | ||
</Metadata> | ||
</PAMRasterBand> | ||
</PAMDataset> |
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,38 @@ | ||
//! Raster ground control point support | ||
|
||
use foreign_types::ForeignTypeRef; | ||
use crate::spatial_ref::SpatialRefRef; | ||
use crate::Dataset; | ||
|
||
impl Dataset { | ||
/// Get output spatial reference system for GCPs. | ||
/// | ||
/// # Notes | ||
/// * This is separate and distinct from [`Dataset::spatial_ref`], and only applies to | ||
/// the representation of ground control points, when embedded. | ||
/// | ||
/// See: [`GDALGetGCPSpatialRef`](https://gdal.org/api/raster_c_api.html#_CPPv420GDALGetGCPSpatialRef12GDALDatasetH) | ||
pub fn gcp_spatial_ref(&self) -> Option<&SpatialRefRef> { | ||
let c_ptr = unsafe { gdal_sys::GDALGetGCPSpatialRef(self.c_dataset()) }; | ||
|
||
if c_ptr.is_null() { | ||
return None; | ||
} | ||
|
||
Some(unsafe { SpatialRefRef::from_ptr(c_ptr) }) | ||
} | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use crate::test_utils::fixture; | ||
use crate::Dataset; | ||
|
||
#[test] | ||
fn test_gcp_spatial_ref() { | ||
let dataset = Dataset::open(fixture("gcp.tif")).unwrap(); | ||
let gcp_srs = dataset.gcp_spatial_ref(); | ||
let auth = gcp_srs.and_then(|s| s.authority().ok()); | ||
assert_eq!(auth.unwrap(), "EPSG:4326"); | ||
} | ||
} |
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.
We could return a SpatialRefRef here, right?
One more reason to rename these to SpatialReference.