Skip to main content

Crate proj_core

Crate proj_core 

Source
Expand description

Pure-Rust coordinate transformation library.

No C dependencies, no unsafe, WASM-compatible.

The primary type is Transform, which provides CRS-to-CRS coordinate transformation using authority codes (e.g., "EPSG:4326"). For area-aware or policy-constrained selection, use Transform::with_selection_options and inspect Transform::selected_operation / Transform::selection_diagnostics. The registry, operation, and grid modules expose the embedded operation catalog, selection metadata, and NTv2 grid-provider interfaces.

§Example

use proj_core::Transform;

// Create a transform from WGS84 geographic to Web Mercator
let t = Transform::new("EPSG:4326", "EPSG:3857").unwrap();

// Transform NYC coordinates (lon, lat in degrees) → (x, y in meters)
let (x, y) = t.convert((-74.006, 40.7128)).unwrap();
assert!((x - (-8238310.0)).abs() < 100.0);

// Inverse: Web Mercator → WGS84
let inv = Transform::new("EPSG:3857", "EPSG:4326").unwrap();
let (lon, lat) = inv.convert((x, y)).unwrap();
assert!((lon - (-74.006)).abs() < 1e-6);

Re-exports§

pub use coord::Bounds;
pub use coord::Coord;
pub use coord::Coord3D;
pub use coord::Transformable;
pub use coord::Transformable3D;
pub use crs::CrsDef;
pub use crs::GeographicCrsDef;
pub use crs::LinearUnit;
pub use crs::ProjectedCrsDef;
pub use crs::ProjectionMethod;
pub use datum::Datum;
pub use datum::DatumGridShift;
pub use datum::DatumGridShiftEntry;
pub use datum::DatumToWgs84;
pub use datum::HelmertParams;
pub use ellipsoid::Ellipsoid;
pub use error::Error;
pub use error::Result;
pub use grid::EmbeddedGridProvider;
pub use grid::FilesystemGridProvider;
pub use grid::GridDefinition;
pub use grid::GridError;
pub use grid::GridFormat;
pub use grid::GridHandle;
pub use grid::GridProvider;
pub use grid::GridSample;
pub use operation::AreaOfInterest;
pub use operation::AreaOfInterestCrs;
pub use operation::AreaOfUse;
pub use operation::CoordinateOperation;
pub use operation::CoordinateOperationId;
pub use operation::CoordinateOperationMetadata;
pub use operation::GridCoverageMiss;
pub use operation::GridId;
pub use operation::GridInterpolation;
pub use operation::GridShiftDirection;
pub use operation::OperationAccuracy;
pub use operation::OperationMatchKind;
pub use operation::OperationMethod;
pub use operation::OperationSelectionDiagnostics;
pub use operation::OperationStep;
pub use operation::OperationStepDirection;
pub use operation::SelectionOptions;
pub use operation::SelectionPolicy;
pub use operation::SelectionReason;
pub use operation::SkippedOperation;
pub use operation::SkippedOperationReason;
pub use operation::TransformOutcome;
pub use registry::lookup_authority_code;
pub use registry::lookup_datum_epsg;
pub use registry::lookup_epsg;
pub use registry::lookup_operation;
pub use registry::operation_candidates_between;
pub use registry::operation_candidates_between_with_selection_options;
pub use registry::operations_between;
pub use transform::Transform;

Modules§

coord
crs
datum
ellipsoid
Reference ellipsoid definitions.
error
grid
operation
registry
transform