pub struct SpatialRef(_);
Expand description

A OpenGIS Spatial Reference System definition.

Used in geo-referencing raster and vector data, and in coordinate transformations.

Notes

Implementations§

source§

impl SpatialRef

source

pub fn new() -> Result<SpatialRef>

source

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.

source

pub fn to_c_hsrs(&self) -> OGRSpatialReferenceH

Returns a C pointer to the allocated gdal_sys::OGRSpatialReferenceH memory.

source

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.

source

pub fn from_wkt(wkt: &str) -> Result<SpatialRef>

source

pub fn from_epsg(epsg_code: u32) -> Result<SpatialRef>

source

pub fn from_proj4(proj4_string: &str) -> Result<SpatialRef>

source

pub fn from_esri(esri_wkt: &str) -> Result<SpatialRef>

source

pub fn to_wkt(&self) -> Result<String>

source

pub fn morph_to_esri(&self) -> Result<()>

source

pub fn to_pretty_wkt(&self) -> Result<String>

source

pub fn to_xml(&self) -> Result<String>

source

pub fn to_proj4(&self) -> Result<String>

source

pub fn to_projjson(&self) -> Result<String>

source

pub fn auth_name(&self) -> Result<String>

source

pub fn auth_code(&self) -> Result<i32>

source

pub fn authority(&self) -> Result<String>

source

pub fn auto_identify_epsg(&mut self) -> Result<()>

source

pub fn name(&self) -> Result<String>

source

pub fn angular_units_name(&self) -> Result<String>

source

pub fn angular_units(&self) -> f64

source

pub fn linear_units_name(&self) -> Result<String>

source

pub fn linear_units(&self) -> f64

source

pub fn is_geographic(&self) -> bool

source

pub fn is_derived_geographic(&self) -> bool

source

pub fn is_local(&self) -> bool

source

pub fn is_projected(&self) -> bool

source

pub fn is_compound(&self) -> bool

source

pub fn is_geocentric(&self) -> bool

source

pub fn is_vertical(&self) -> bool

source

pub fn axis_orientation( &self, target_key: &str, axis: i32 ) -> Result<AxisOrientationType>

source

pub fn axis_name(&self, target_key: &str, axis: i32) -> Result<String>

source

pub fn axes_count(&self) -> i32

source

pub fn set_axis_mapping_strategy(&self, strategy: Type)

source

pub fn get_axis_mapping_strategy(&self) -> Type

👎Deprecated: use axis_mapping_strategy instead
source

pub fn axis_mapping_strategy(&self) -> Type

source

pub fn area_of_use(&self) -> Option<AreaOfUse>

Get the valid use bounding area for this SpatialRef.

See: OSRGetAreaOfUse

source

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

source

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

source

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

source

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

source

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

source

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 return nullptr) 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.

source

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

source§

fn clone(&self) -> SpatialRef

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for SpatialRef

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for SpatialRef

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl PartialEq<SpatialRef> for SpatialRef

source§

fn eq(&self, other: &SpatialRef) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.