Skip to main content

Pj

Struct Pj 

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

A prepared coordinate operation with input/output unit handling.

Wraps an inner Operation and applies the unit conversions, prime-meridian and central-meridian shifts, and axis bookkeeping that PROJ performs around the raw projection math.

§Field visibility and invariants

A Pj is a prepared operation: its fields are mutually consistent by construction (only crate::create and the crate-internal registry::build_single_op produce a valid one). All fields are therefore pub(crate) and reachable from outside the crate only through the read accessors on Pj. Flipping, for example, inverted or bypass_prepare_finalize after construction would silently invalidate the prepare/finalize contract, so those knobs are deliberately not externally writable.

The operation’s boundary — its reference ellipsoid and forward-sense input/output units — is exposed read-only through the ellipsoid, left and right accessors, which downstream crates (the CLI, parity harnesses) depend on. Their invariant: left/right are the forward-sense input/output units of the whole operation, and ellipsoid is the reference ellipsoid the boundary math is expressed against. They are read-only; mutating them would not re-derive any of the dependent fields.

Implementations§

Source§

impl Pj

Source

pub fn operation(&self) -> &dyn Operation

The inner operation (projection or conversion) as a trait reference.

Source

pub fn op_name(&self) -> &str

The operation name (e.g. "merc", "axisswap"); empty for a pipeline.

Source

pub fn inverted(&self) -> bool

Whether this operation runs inverted in its containing pipeline.

Source

pub fn inner_has_inverse(&self) -> bool

Whether the wrapped inner operation provides an inverse.

Unlike the Operation::has_inverse default (which the Pj wrapper inherits as always-true), this reports the inner operation’s own answer — e.g. false for a forward-only projection like urm5 or a singular affine. The pipeline builder uses it to reject, at creation time, a step whose required direction has no implementation, mirroring PROJ’s pj_create_pipeline forward-path check (src/pipeline.cpp).

Source

pub fn is_latlong(&self) -> bool

Whether this is a pass-through geographic (lat/long) operation.

Source

pub fn lam0(&self) -> f64

Central meridian (radians).

Source

pub fn phi0(&self) -> f64

Latitude of origin (radians).

Source

pub fn x0(&self) -> f64

False easting (meters, pre-scale).

Source

pub fn y0(&self) -> f64

False northing (meters, pre-scale).

Source

pub fn z0(&self) -> f64

False up (meters, pre-scale).

Source

pub fn k0(&self) -> f64

Scale factor at the central meridian.

Source

pub fn to_meter(&self) -> f64

Horizontal input-unit-to-meter factor.

Source

pub fn fr_meter(&self) -> f64

Horizontal meter-to-output-unit factor.

Source

pub fn vto_meter(&self) -> f64

Vertical input-unit-to-meter factor.

Source

pub fn vfr_meter(&self) -> f64

Vertical meter-to-output-unit factor.

Source

pub fn from_greenwich(&self) -> f64

Prime-meridian offset from Greenwich (radians).

Source

pub fn over(&self) -> bool

Allow longitudes outside the normal range (+over).

Source

pub fn geoc(&self) -> bool

Geocentric latitude flag (+geoc).

Source

pub fn ellipsoid(&self) -> Ellipsoid

The reference ellipsoid the boundary math is expressed against.

Source

pub fn left(&self) -> IoUnits

Input units of the whole operation (forward direction).

Source

pub fn right(&self) -> IoUnits

Output units of the whole operation (forward direction).

Source

pub fn forward(&self, c: Coord) -> ProjResult<Coord>

Run the operation in the forward direction, honoring inverted.

Source

pub fn inverse(&self, c: Coord) -> ProjResult<Coord>

Run the operation in the inverse direction, honoring inverted.

Source

pub fn factors(&self, coord: Coord) -> ProjResult<Factors>

Compute map-scale factors (Tissot indicatrix) at a geographic coordinate.

coord must be in geographic input units — radians if self.left == IoUnits::Radians, degrees if self.left == IoUnits::Degrees. The coordinate layout is Coord::new(longitude, latitude, z, t).

Returns the oxiproj_core::Factors struct describing Tissot indicatrix parameters at the given point.

Ported from PROJ 9.8.0 src/factors.cpp (proj_factorspj_factorspj_deriv).

Source

pub fn factors_exact(&self, coord: Coord) -> ProjResult<FactorsExact>

Compute exact distortion factors via automatic differentiation.

Returns Err(ProjError::UnsupportedOperation) when:

  • ad_proj is None (no AD-capable projection registered), or
  • the projection’s project_fwd_generic returns UnsupportedOperation.

coord must be in the same geographic input units as for Pj::factors.

Trait Implementations§

Source§

impl Debug for Pj

Source§

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

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

impl Operation for Pj

Source§

fn forward_4d(&self, c: Coord) -> ProjResult<Coord>

Apply the 4D forward operation on a full Coord (with time). Read more
Source§

fn inverse_4d(&self, c: Coord) -> ProjResult<Coord>

Apply the 4D inverse operation on a full Coord (with time). Read more
Source§

fn forward_2d(&self, lp: Lp) -> ProjResult<Xy>

Apply the 2D forward operation, mapping geodetic Lp to projected Xy. Read more
Source§

fn inverse_2d(&self, xy: Xy) -> ProjResult<Lp>

Apply the 2D inverse operation, mapping projected Xy back to geodetic Lp. Read more
Source§

fn forward_3d(&self, lpz: Lpz) -> Result<Xyz, ProjError>

Apply the 3D forward operation, mapping geodetic Lpz to Cartesian Xyz. Read more
Source§

fn inverse_3d(&self, xyz: Xyz) -> Result<Lpz, ProjError>

Apply the 3D inverse operation, mapping Cartesian Xyz back to geodetic Lpz. Read more
Source§

fn has_inverse(&self) -> bool

Report whether an inverse operation is available (default true).

Auto Trait Implementations§

§

impl !RefUnwindSafe for Pj

§

impl !UnwindSafe for Pj

§

impl Freeze for Pj

§

impl Send for Pj

§

impl Sync for Pj

§

impl Unpin for Pj

§

impl UnsafeUnpin for Pj

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, 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.