Struct gdal::spatial_ref::SpatialRef
source · pub struct SpatialRef(_);
Expand description
A OpenGIS Spatial Reference System definition.
Used in geo-referencing raster and vector data, and in coordinate transformations.
Notes
- See also: OGR Coordinate Reference Systems and Coordinate Transformation Tutorial
- Consult the OGC WKT Coordinate System Issues page for implementation details of WKT in OGR.
Implementations§
source§impl SpatialRef
impl SpatialRef
pub fn new() -> Result<SpatialRef>
sourcepub unsafe fn from_c_obj(c_obj: OGRSpatialReferenceH) -> Result<SpatialRef>
pub unsafe fn from_c_obj(c_obj: OGRSpatialReferenceH) -> Result<SpatialRef>
Returns a wrapped SpatialRef
from a raw C API handle.
Safety
The handle passed to this function must be valid.
sourcepub fn to_c_hsrs(&self) -> OGRSpatialReferenceH
pub fn to_c_hsrs(&self) -> OGRSpatialReferenceH
Returns a C pointer to the allocated gdal_sys::OGRSpatialReferenceH
memory.
sourcepub fn from_definition(definition: &str) -> Result<SpatialRef>
pub fn from_definition(definition: &str) -> Result<SpatialRef>
Set spatial reference from various text formats.
This method will examine the provided input, and try to deduce the format, and then use it to initialize the spatial reference system. See the C++ API docs for details on these forms.
pub fn from_wkt(wkt: &str) -> Result<SpatialRef>
pub fn from_epsg(epsg_code: u32) -> Result<SpatialRef>
pub fn from_proj4(proj4_string: &str) -> Result<SpatialRef>
pub fn from_esri(esri_wkt: &str) -> Result<SpatialRef>
pub fn to_wkt(&self) -> Result<String>
pub fn morph_to_esri(&self) -> Result<()>
pub fn to_pretty_wkt(&self) -> Result<String>
pub fn to_xml(&self) -> Result<String>
pub fn to_proj4(&self) -> Result<String>
pub fn to_projjson(&self) -> Result<String>
pub fn auth_name(&self) -> Result<String>
pub fn auth_code(&self) -> Result<i32>
pub fn auto_identify_epsg(&mut self) -> Result<()>
pub fn name(&self) -> Result<String>
pub fn angular_units_name(&self) -> Result<String>
pub fn angular_units(&self) -> f64
pub fn linear_units_name(&self) -> Result<String>
pub fn linear_units(&self) -> f64
pub fn is_geographic(&self) -> bool
pub fn is_derived_geographic(&self) -> bool
pub fn is_local(&self) -> bool
pub fn is_projected(&self) -> bool
pub fn is_compound(&self) -> bool
pub fn is_geocentric(&self) -> bool
pub fn is_vertical(&self) -> bool
pub fn axis_orientation( &self, target_key: &str, axis: i32 ) -> Result<AxisOrientationType>
pub fn axis_name(&self, target_key: &str, axis: i32) -> Result<String>
pub fn axes_count(&self) -> i32
pub fn set_axis_mapping_strategy(&self, strategy: Type)
pub fn get_axis_mapping_strategy(&self) -> Type
axis_mapping_strategy
insteadpub fn axis_mapping_strategy(&self) -> Type
sourcepub fn area_of_use(&self) -> Option<AreaOfUse>
pub fn area_of_use(&self) -> Option<AreaOfUse>
Get the valid use bounding area for this SpatialRef
.
See: OSRGetAreaOfUse
sourcepub fn semi_major(&self) -> Result<f64>
pub fn semi_major(&self) -> Result<f64>
Get spheroid semi-major axis.
Returns an error if the semi-major axis can’t be found
See: OSRGetSemiMajor
sourcepub fn semi_minor(&self) -> Result<f64>
pub fn semi_minor(&self) -> Result<f64>
Get spheroid semi-minor axis.
Returns an error if the semi-minor axis can’t be found
See: OSRGetSemiMinor
sourcepub fn set_proj_param(&mut self, name: &str, value: f64) -> Result<()>
pub fn set_proj_param(&mut self, name: &str, value: f64) -> Result<()>
Set a projection parameter value.
Returns an error if there the PROJCS
node is missing.
See: OSRSetProjParm
sourcepub fn get_proj_param(&self, name: &str) -> Result<Option<f64>>
pub fn get_proj_param(&self, name: &str) -> Result<Option<f64>>
Fetch a projection parameter value.
Returns:
Ok(Some(value))
- if parameter is sucessfully found,Ok(None)
- if parameter is not found (C library will return OGRERR_FAILURE),Err(_)
- if there is a string conversion error or on other GDAL OGR error.
See: OSRGetProjParm
sourcepub fn set_attr_value(
&mut self,
node_path: &str,
new_value: Option<&str>
) -> Result<()>
pub fn set_attr_value( &mut self, node_path: &str, new_value: Option<&str> ) -> Result<()>
Set attribute value in spatial reference.
Returns error in case if path was invalid or on GDAL OGR error.
See: OSRSetAttrValue
sourcepub fn get_attr_value(
&self,
node_path: &str,
child: usize
) -> Result<Option<String>>
pub fn get_attr_value( &self, node_path: &str, child: usize ) -> Result<Option<String>>
Fetch indicated attribute of named node.
Returns:
Ok(Some(value))
- if node and attribute are sucessfully found,Ok(None)
- if node or attribute are not found (C library will returnnullptr
) or attribute contains no value,Err(_)
- if there is a string conversion error.
See: OSRGetProjParm
Panics
Panics if child
is greater than libc::c_int::MAX
.
sourcepub fn geog_cs(&self) -> Result<SpatialRef>
pub fn geog_cs(&self) -> Result<SpatialRef>
Make a duplicate of the GEOGCS
node of this SpatialRef
.
Returns an error if the GEOGCS
node is missing.
See: OSRCloneGeogCS
Trait Implementations§
source§impl Clone for SpatialRef
impl Clone for SpatialRef
source§fn clone(&self) -> SpatialRef
fn clone(&self) -> SpatialRef
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for SpatialRef
impl Debug for SpatialRef
source§impl Drop for SpatialRef
impl Drop for SpatialRef
source§impl PartialEq<SpatialRef> for SpatialRef
impl PartialEq<SpatialRef> for SpatialRef
source§fn eq(&self, other: &SpatialRef) -> bool
fn eq(&self, other: &SpatialRef) -> bool
self
and other
values to be equal, and is used
by ==
.