pub struct GeoKeyParser;Expand description
Parser for GeoTIFF geographic metadata
Implementations§
Source§impl GeoKeyParser
impl GeoKeyParser
Sourcepub fn parse_geo_key_directory(
ifd: &IFD,
byte_order_handler: &Box<dyn ByteOrderHandler>,
file_path: &str,
) -> TiffResult<Vec<GeoKeyEntry>>
pub fn parse_geo_key_directory( ifd: &IFD, byte_order_handler: &Box<dyn ByteOrderHandler>, file_path: &str, ) -> TiffResult<Vec<GeoKeyEntry>>
Parse the GeoKey directory from an IFD
GeoKeys are the main way geographic information is stored in GeoTIFF files. They are organized as a directory with a standard structure defined by the GeoTIFF specification, consisting of a header and a series of key entries.
§Arguments
ifd- The IFD containing the GeoKey directorybyte_order_handler- Handler for the file’s byte orderfile_path- Path to the TIFF file
§Returns
TiffResult<Vec<GeoKeyEntry>>- A vector of GeoKey entries if found
Sourcepub fn get_geo_key_value_as_string(
ifd: &IFD,
key_entry: &GeoKeyEntry,
byte_order_handler: &Box<dyn ByteOrderHandler>,
file_path: &str,
) -> TiffResult<String>
pub fn get_geo_key_value_as_string( ifd: &IFD, key_entry: &GeoKeyEntry, byte_order_handler: &Box<dyn ByteOrderHandler>, file_path: &str, ) -> TiffResult<String>
Get the value of a GeoKey as a string
GeoKeys can store values in three ways:
- Directly in the value_offset field (when tiff_tag_location = 0)
- In the GeoDoubleParamsTag (when tiff_tag_location = 34736)
- In the GeoAsciiParamsTag (when tiff_tag_location = 34737)
This method handles all three cases and returns the value as a string.
§Arguments
ifd- The IFD containing the GeoKeykey_entry- The specific GeoKey entry to retrievebyte_order_handler- Handler for the file’s byte orderfile_path- Path to the TIFF file
§Returns
TiffResult<String>- The key’s value as a string
Sourcepub fn read_model_pixel_scale_values(
ifd: &IFD,
byte_order_handler: &Box<dyn ByteOrderHandler>,
file_path: &str,
) -> TiffResult<Vec<f64>>
pub fn read_model_pixel_scale_values( ifd: &IFD, byte_order_handler: &Box<dyn ByteOrderHandler>, file_path: &str, ) -> TiffResult<Vec<f64>>
Read model pixel scale values (x_scale, y_scale, z_scale)
ModelPixelScaleTag (33550) contains the pixel size in map units, which is essential for converting between pixel and world coordinates. The tag typically contains 3 values: x_scale, y_scale, and z_scale.
§Arguments
ifd- The IFD containing the ModelPixelScaleTagbyte_order_handler- Handler for the file’s byte orderfile_path- Path to the TIFF file
§Returns
TiffResult<Vec<f64>>- Vector of scale values [x_scale, y_scale, z_scale]
Sourcepub fn read_model_tiepoint_values(
ifd: &IFD,
byte_order_handler: &Box<dyn ByteOrderHandler>,
file_path: &str,
) -> TiffResult<Vec<f64>>
pub fn read_model_tiepoint_values( ifd: &IFD, byte_order_handler: &Box<dyn ByteOrderHandler>, file_path: &str, ) -> TiffResult<Vec<f64>>
Read model tiepoint values (i,j,k,x,y,z)
ModelTiepointTag (33922) defines how raster coordinates map to world coordinates. Each tiepoint consists of 6 values: i,j,k (raster coordinates) and x,y,z (world coordinates). The tag can contain multiple tiepoints, each with 6 values.
§Arguments
ifd- The IFD containing the ModelTiepointTagbyte_order_handler- Handler for the file’s byte orderfile_path- Path to the TIFF file
§Returns
TiffResult<Vec<f64>>- Vector of tiepoint values [i,j,k,x,y,z,…]
Sourcepub fn extract_geo_info(
ifd: &IFD,
byte_order_handler: &Box<dyn ByteOrderHandler>,
file_path: &str,
) -> TiffResult<GeoInfo>
pub fn extract_geo_info( ifd: &IFD, byte_order_handler: &Box<dyn ByteOrderHandler>, file_path: &str, ) -> TiffResult<GeoInfo>
Extract geospatial information from a TIFF IFD
Interprets all the GeoTIFF tags and keys to build a comprehensive GeoInfo structure containing projection information, pixel sizes, and georeferencing parameters.
§Arguments
ifd- The IFD to extract information frombyte_order_handler- Handler for the file’s byte orderfile_path- Path to the TIFF file
§Returns
TiffResult<GeoInfo>- Structure with extracted geospatial information
Sourcepub fn format_projection_string(geo_info: &GeoInfo) -> String
pub fn format_projection_string(geo_info: &GeoInfo) -> String
Format a human-readable GeoTIFF projection string
Interprets the projection information in a GeoInfo structure and returns a human-readable description of the coordinate system.
§Arguments
geo_info- The GeoInfo structure containing projection information
§Returns
String- Human-readable description of the projection
Sourcepub fn format_geo_keys(
ifd: &IFD,
byte_order_handler: &Box<dyn ByteOrderHandler>,
file_path: &str,
) -> TiffResult<Vec<(u16, String, u16, u16, u16, String)>>
pub fn format_geo_keys( ifd: &IFD, byte_order_handler: &Box<dyn ByteOrderHandler>, file_path: &str, ) -> TiffResult<Vec<(u16, String, u16, u16, u16, String)>>
Format GeoKeys for display
Creates a vector of tuples containing all GeoKey information, formatted for display in a human-readable format.
§Arguments
ifd- The IFD containing the GeoKeysbyte_order_handler- Handler for the file’s byte orderfile_path- Path to the TIFF file
§Returns
TiffResult<Vec<(u16, String, u16, u16, u16, String)>>- Vector of tuples with (key_id, key_name, tag_location, count, value_offset, value_string)
Auto Trait Implementations§
impl Freeze for GeoKeyParser
impl RefUnwindSafe for GeoKeyParser
impl Send for GeoKeyParser
impl Sync for GeoKeyParser
impl Unpin for GeoKeyParser
impl UnsafeUnpin for GeoKeyParser
impl UnwindSafe for GeoKeyParser
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more