Skip to main content

Transform

Struct Transform 

Source
pub struct Transform { /* private fields */ }
Expand description

A reusable coordinate transformation between two CRS.

Implementations§

Source§

impl Transform

Source

pub fn new(from_crs: &str, to_crs: &str) -> Result<Self>

Create a transform from authority code strings (e.g., "EPSG:4326").

Source

pub fn with_selection_options( from_crs: &str, to_crs: &str, options: SelectionOptions, ) -> Result<Self>

Create a transform with explicit selection options.

Source

pub fn from_operation( operation_id: CoordinateOperationId, from_crs: &str, to_crs: &str, ) -> Result<Self>

Create a transform from an explicit registry operation id.

Source

pub fn from_epsg(from: u32, to: u32) -> Result<Self>

Create a transform from EPSG codes directly.

Source

pub fn from_crs_defs(from: &CrsDef, to: &CrsDef) -> Result<Self>

Create a transform from explicit CRS definitions.

Source

pub fn from_crs_defs_with_selection_options( from: &CrsDef, to: &CrsDef, options: SelectionOptions, ) -> Result<Self>

Create a transform from explicit CRS definitions with operation-selection options.

Use this when a custom CRS references grid resources and the transform needs an application-supplied crate::grid::GridProvider.

Source

pub fn convert<T: Transformable>(&self, coord: T) -> Result<T>

Transform a single coordinate.

Source

pub fn convert_3d<T: Transformable3D>(&self, coord: T) -> Result<T>

Transform a single 3D coordinate.

Source

pub fn convert_with_diagnostics<T: Transformable>( &self, coord: T, ) -> Result<TransformOutcome<T>>

Transform a single coordinate and report the operation actually used.

When the selected grid-backed operation misses grid coverage, this reports the coverage misses and the lower-ranked fallback operation that produced the result.

Source

pub fn convert_3d_with_diagnostics<T: Transformable3D>( &self, coord: T, ) -> Result<TransformOutcome<T>>

Transform a single 3D coordinate and report the operation actually used.

When the selected grid-backed operation misses grid coverage, this reports the coverage misses and the lower-ranked fallback operation that produced the result.

Source

pub fn source_crs(&self) -> &CrsDef

Return the source CRS definition for this transform.

Source

pub fn target_crs(&self) -> &CrsDef

Return the target CRS definition for this transform.

Source

pub fn selected_operation(&self) -> &CoordinateOperationMetadata

Return metadata for the selected coordinate operation.

Source

pub fn selection_diagnostics(&self) -> &OperationSelectionDiagnostics

Return selection diagnostics for this transform.

Source

pub fn inverse(&self) -> Result<Self>

Build the inverse transform by swapping the source and target CRS.

Source

pub fn transform_bounds( &self, bounds: Bounds, densify_points: usize, ) -> Result<Bounds>

Reproject a 2D bounding box by sampling its perimeter.

Source

pub fn convert_batch<T: Transformable + Clone>( &self, coords: &[T], ) -> Result<Vec<T>>

Batch transform (sequential).

Source

pub fn convert_batch_3d<T: Transformable3D + Clone>( &self, coords: &[T], ) -> Result<Vec<T>>

Batch transform of 3D coordinates (sequential).

Source

pub fn convert_coords_in_place(&self, coords: &mut [Coord]) -> Result<()>

Transform 2D coordinates in place without allocating.

Coordinates before a failing coordinate are left converted; the failing coordinate and subsequent coordinates are left unchanged.

Source

pub fn convert_coords_3d_in_place(&self, coords: &mut [Coord3D]) -> Result<()>

Transform 3D coordinates in place without allocating.

Coordinates before a failing coordinate are left converted; the failing coordinate and subsequent coordinates are left unchanged.

Source

pub fn convert_coords_into( &self, input: &[Coord], output: &mut [Coord], ) -> Result<()>

Transform 2D coordinates from input into an existing output slice.

output must have exactly the same length as input. This API performs no allocation and does not require cloning input coordinates.

Source

pub fn convert_coords_3d_into( &self, input: &[Coord3D], output: &mut [Coord3D], ) -> Result<()>

Transform 3D coordinates from input into an existing output slice.

output must have exactly the same length as input. This API performs no allocation and does not require cloning input coordinates.

Source

pub fn convert_batch_parallel<T: Transformable + Send + Sync + Clone>( &self, coords: &[T], ) -> Result<Vec<T>>

Batch transform with Rayon parallelism.

Source

pub fn convert_batch_parallel_3d<T: Transformable3D + Send + Sync + Clone>( &self, coords: &[T], ) -> Result<Vec<T>>

Batch transform of 3D coordinates with adaptive Rayon parallelism.

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.